转载请注明出处:http://blog.csdn.net/l1028386804/article/details/51537000
这些配置是基于VMware Network Adapter VMnet8,假设我的VMware Network Adapter VMnet8 ip地址是192.168.106.1
具体如下图:
则我的ifcfg-eth0文件配置如下:
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我将我CentOS的ip设置为192.168.106.130 与VMware Network Adapter VMnet8在同一个网段。
注:ifcfg-eth0文件在CentOS中的路径为:/etc/sysconfig/network-scripts/ifcfg-eth0
修改文件后要执行命令#service network restart 或者 #/etc/init.d/network restart 使修改生效