VM setting in host-only mode (wired-wireless network)
Experimental environment:
VMware 12
Liunx CentOS-6.4-i386
Install linux under the virtual machine, but cannot ping each other with the host
1. Confirm the way of surfing the Internet first.
Host-only Internet access: in this mode, the communication between the host and the virtual machine is realized through the virtual network card VMware Network VMnet1
2. VMware Network VMnet1 of the host
Click the VMware Network Adepter VMnet1 above to set up the virtual network card as shown below:
As shown in the figure above, the IP address is entered as 192.168.0.1 and the subnet mask is 255.255.255.0 in the format of 192.168.0.1
PS [this address is used as the gateway for linux in the virtual machine]
3. Linux under the virtual machine
Modify the network card
Modify the configuration file
Vi / etc/sysconfig/network-scripts/ifcfg-eth0
IPADDR=192.168.0.99
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
Add the above 3 lines, # comment BOOTPROTO, press 2 dd to delete HWADDR
Change the DEVICE value to eth0
When you are done, click esc on the keyboard, then a colon, type x, and save exit
Service network restart
Ifconfig View
Then ping the virtual machine in the host computer.
Check the host ip:192.168.16.103 in cmd, and then ping it in the virtual machine
The figure below is as follows
Here's the problem. The ping in the virtual machine is not connected to the host.
The virtual machine ping is not connected to the host because there is no shared network for vmnet1.
Start to solve (in wireless case)
Click to share
Then select the drop-down box, as shown below
Then click OK and the following figure appears
It means that if you set sharing, the ip of Vmnet1 will be changed to 192.168.137.1, click Yes, and then change the ip of Vmnet1 to 192.168.0.1, and change the method to step 2.
So you can get through to ping.
Start to solve (in wired case)
Click share, tick
Then click OK and the following figure appears
It means that if you set sharing, the ip of Vmnet1 will be changed to 192.168.137.1, click Yes, and then change the ip of Vmnet1 to 192.168.0.1, and change the method to step 2.
So you can get through to ping.