Edit the network card file vim /etc/sysconfig/network-scripts/ifcfg-ens33
and add the following content to the file
IPADDR=192.168.0.111 #静态ip,添加前先ping一下该ip,ping不通才能使用,确保唯一
NETMASK=255.255.255.0 #子网掩码
GATEWAY=192.168.1.1 #网关
Complete configuration file:
DEVICE=ens33
BOOTPROTO=static
HWADDR=00:0c:29:5a:71:6d
IPV6INIT=yes
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
UUID="793813e9-4cbd-4ae1-a1de-f9f38b8369ee"
USERCTL=no
PEERDNS=yes
IPADDR=192.168.0.111
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
This machine opens cmd to test ping 192.168.0.111
GET!!!