首頁 > 軟體

RHCE認證學習:RHEL7 網路設定

2020-06-16 17:46:43

VMware Workstation 12.0.1 build-3160714

Red Hat Enterprise Linux Server release 7.0 (Maipo)

一 設定網絡卡

1,編輯網絡卡組態檔

# vim /etc/sysconfig/network-scripts/ifcfg-eno16777736

HWADDR=00:0C:29:5D:34:28

TYPE=Ethernet

BOOTPROTO=static  ##dhcp:自動獲取IP,static:靜態IP,none:不用協定

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

IPV6_FAILURE_FATAL=no

NAME=eno16777736

UUID=3af1bda7-d937-4aba-bbdf-e9c7eeef0dd9

ONBOOT=yes   ##啟動network服務時是否啟用該網絡卡,yes為啟用

IPADDR=192.168.16.91

NETMASK=255.255.255.0

GATEWAY=192.168.16.1

DNS1=8.8.8.8

2,重新啟動網路服務

#systemctl restart network

二 修改主機名

#vim /etc/hostname

cnblog.localdomain

三 修改hosts

#vim /etc/hosts

192.168.16.91   cnblog.localdomain cnblog

#hostname -i

192.168.16.91

四 單網絡卡設定雙IP

1,編輯網絡卡組態檔

#cp /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eno16777736:0

# vim /etc/sysconfig/network-scripts/ifcfg-eno16777736:0

DEVICE=eno16777736:0

HWADDR=00:0C:29:5D:34:28

TYPE=Ethernet

BOOTPROTO=static 

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

IPV6_FAILURE_FATAL=no

NAME=eno16777736

UUID=3af1bda7-d937-4aba-bbdf-e9c7eeef0dd9

ONBOOT=yes

IPADDR=192.168.16.92

NETMASK=255.255.255.0

GATEWAY=192.168.16.1

DNS1=8.8.8.8

2,重新啟動網路服務

#systemctl restart network

五 雙網絡卡系結模式

1,確定核心是否制定bonding

# cat /boot/config-3.10.0-123.el7.x86_64 | grep -i bonding

CONFIG_BONDING=m

本文永久更新連結地址http://www.linuxidc.com/Linux/2016-01/127907.htm


IT145.com E-mail:sddin#qq.com