Go to catalogue /etc/sysconfig/network-scripts
VI ifcfg-eno16777736
DHCP Dynamic settings
Just change the last line onboot=no to Omboot=yes, re-save, and restart the Web Services service network restart. You can test with the ping command. (The default installation does not support some commands such as ifconfig, subsequent installation of related modules) or using IP addr (can be abbreviated as IP a)
Static IP Settings
As a server, it is set to static IP. To set the method, first add the following code:
Hwaddr=00:0c:29:e0:27:a5
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=a34bdb2f-9010-4fc1-84a2-b915eebf7b65
device=eno16777736
Onboot=yes
ipaddr=192.168.222.128
gateway=192.168.222.255
netmask=255.255.255.0
dns=192.168.222.255
Nm_controlled=no//Do not use network Manager
Restarting network (via systemctl): Job fornetwork.service failed. See‘systemctl status network.service‘ and ‘journalctl -xn‘ fordetails
1、首先确定ifcfg-eno16777736文件中的HWADDR(MAC地址)与ip a命令后显示的MAC是否一致。
2、使用service network restart 或者systemctl restart network.service 命令,可能不会立即生效。使用ifdown eno16777736,然后ifup eno16777736 即可。
CentOS 7 Network configuration