RHCE认证学习:RHEL7 网络配置

# 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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/15582.html