First, after installing CentOS, check the virtual machine----right---set the virtual machine to NAT mode
Select Edit--Virtual network editor--View or edit subnet IP and subnet masks
Check NAT settings to view gateway IP
View the ifconfig before the configuration and record the Mac
The following begins the formal configuration of the specified IP:
Edit under root privileges: Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device= "Eth0" #第一块网卡
bootproto= Sign of "static" #设置成静态ip
Hwaddr= "00:0c:29:bd:f4:e5" #上面指定的MAC地址
ipv6init= "Yes"
Ipaddr= "192.168.135.155" #要指定的 IP
Gateway= "192.168.135.2" #网关
netmask= "255.255.255.0" #子网掩码
nm_controlled= "No"
arpcheck= "NO"
onboot= "Yes"
Type= "Ethernet"
Uuid= "1be372d0-5fbe-420d-9847-c5b45792cae9" #如果是clone the CentOS cluster, then this UUID is consistent
Editor: vi/etc/resolv.conf
Add to:
NameServer 192.168.135.2 #网关对应
Perform/etc/init.d/network restart to net restart
View IP by ifconfig
Test network conditions by pinging www.baidu.com
For the final test:
If the ping is not able to: in the network connection will be VMnet1 disabled after the attempt, if not, try to restart the CentOS test
CentOS settings in VMWare specify NAT IP to access the network at the same time