This problem stuck me for more than a day, and the questions I found on Baidu were various, but it confused me. Finally, the practice was successful, and the configuration process was recorded.
Configure network card and randomly assign ip address
I installed the basic server version, using NAT mode
Then, make sure that in the service, these two are started
When centos was just installed, there was no eth0 network card.
cd /etc/sysconfig/network-scripts
Then ls, you can see that ifcfg-eth0 exists, but it is not activated
vi ifcfg-eth0
It can be seen as follows
Pressing the "insert" key means entering edit mode. Set ONBOOT=yes, then press "esc" key, ":" key, "w" key, "q" key, ifcfg-eth0 is modified
service network restart
Then ifconfig, you can see that eth0 has been randomly assigned an ip address
Ping baidu.com, you can see that you can connect to the Internet (ctrl+c to exit ping)
At this time, remote tools such as putty and winscp can also be connected.
fixed ip address
Virtual Machine-->Edit-->Virtual Network Editor-->vmnet8-->nat Settings
On this page, you can see that the gateway IP is "192.168.255.2" (different for each machine)
Close the gateway viewing page and click the "DHCP Settings" button at the bottom of the page
You can view network information, including:
The starting IP address is "192.168.255.128"
The ending IP address is "192.168.255.254"
The subnet mask is "255.255.255.0"
Check the status of "VMware Network Adapter VMnet8" in Network and Sharing Center
192.168.255.1 is the address assigned by the virtual router to Windows
192.168.255.2 is the gateway address of the virtual router
Then, in centos, enter the command "vi /etc/sysconfig/network-script/ifcfg-eth0" to modify the eth0 information, and press the "insert" key to modify
Modify information:
ONBOOT=yes
BOOTPROTO=static
add information:
IPADDR=192.168.255.100 (adjusted according to the gateway)
NETMASK=255.255.255.0
GATEWAY=192.168.255.2
After modification, press "esc key", ":" key, "w" key, "q" key
service network restart
If the error *** is already in use for device eth0 appears, add ARPCHECK=no to the ifcfg-eth0 file just now
Check the ip you just configured
Can the speed test be connected to the Internet?
you're done