Reprint please indicate the source: http://blog.csdn.net/l1028386804/article/details/51537000
These configurations are based on VMware network Adapter VMnet8, assuming that my VMware network Adapter VMnet8 IP address is 192.168.106.1
The following figure:
My Ifcfg-eth0 file is configured as follows:
Device=eth0
type=ethernet
uuid=f9f0898c-bf2c-4183-857a-eab291cd904d
onboot=yes
NM_CONTROLLED= Yes
bootproto=static
ipaddr=192.168.106.130
netmask=255.255.255.0
broadcast=192.168.106.255
gateway=192.168.106.2
dns1=114.114.114.114
dns2=8.8.8.8
defroute=yes
ipv4_failure_fatal=yes
ipv6init=no
Name= "System eth0"
hwaddr=00:0c:29:22:d2:64
peerdns=yes
peerroutes=yes
last_connect= 1456741165
I set my CentOS IP to 192.168.106.130 with the VMware Network Adapter VMNET8 on the same network segment.
Note: The path to the Ifcfg-eth0 file in CentOS is:/etc/sysconfig/network-scripts/ifcfg-eth0
To execute a command after modifying a file #service network restart or #/etc/init.d/network restart to make the modification take effect