Use an independent IP address to access the Internet in Centos under vmwarevm
First, after centos is installed, select Virtual Machine --> right-click --> set --> Virtual Machine to NAT Mode
Select Edit> Virtual Network editor> View or edit the subnet ip address and subnet mask.
Select NAT settings to view the gateway Ip Address
View ifconfig before configuration and record mac
Configure the specified IP address as follows:
Edit: vi/etc/sysconfig/network-scripts/ifcfg-eth0 with root permissions
DEVICE = "eth0" # The first Nic
BOOTPROTO = "static" # flag of static IP
HWADDR = "00: 0C: 29: BD: F4: E5" # the MAC address specified above
IPV6INIT = "yes"
IPADDR = "192.168.135.155" # ip address to be specified
GATEWAY = "192.168.135.2" # GATEWAY
NETMASK = "255.255.255.0" # Subnet Mask
NM_CONTROLLED = "no"
ARPCHECK = "NO"
ONBOOT = "yes"
TYPE = "Ethernet"
UUID = "1be372d0-5fbe-420d-9847-c5b45792cae9" # if it is a clone centos cluster, the UUID is consistent
Edit: vi/etc/resolv. conf
Add:
Nameserver 192.168.135.2 # Gateway
Run/etc/init. d/network restart to restart net.
View ip address information through ifconfig
Test network conditions through pingwww.baidu.com
Perform the final test:
If the ping fails, you can: Disable VMnet1 in the network connection and try again. If not, try to restart centos for testing.