1 CentOS7最小化安装,生成了ifcfg-ens33,执行命令:cd /etc/sysconfig/network-scripts/,修改ifcfg-ens33为ifcfg-eth0
2 修改ifcfg-eth0文件内容,配置静态IP:
[root@localhost network-scripts]# vi ifcfg-eth0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0
UUID=0ddd2944-4a8e-4a4b-b131-4208d61f786b
DEVICE=ens33
ONBOOT=yes
GATEWAY=192.168.154.2
IPADDR=192.168.154.101
NETMASK=255.255.255.0
DNS1=114.114.114.114
DNS2=192.168.154.2
3 执行命令:ip addr ,查看配置是否生效
4 重启网络服务:systemctl restart network.service
网友评论