[Basics of Operation and Maintenance Knowledge] How to solve the problem when the virtual machine cannot ping the external network

After we went through all the trouble to connect Xshell to the virtual machine, we tried to ping our gateway, but found that Xshell could not ping the gateway or the external network. Without further ado, the solution is as follows.

a. First, we check whether the system IP is the network segment we want to set, for example, the IP is 10.0.0.200. Of course, if Xshell can connect to the virtual machine, then there must be no problem with it.

b. Check the NAT settings in the VMware virtual network editor to see if the gateway IP is 10.0.0.X. It does not need to be modified to be consistent. I set it to 10.0.0.2 here.

26b9c13675637c6bb2bd236bf43b0dda.png
7ce0d29097e707686308ba780e5b1857.png

c. Check whether NAT and other services in the Windows service are turned on. If they are not turned on, the gateway cannot be set, or even if the gateway is set, it will not be able to connect to the local network.

Turn on all VMware services, then right-click Properties and change the startup type to automatic.

b62eee126cfaaec5a2cb80aadb1d4c51.png
ebb24e84a552a555d9b3ee226911b8e0.png

Finally adjusted to this state, all VMware services are started and running, and the startup type is automatic.

c8563126e91f78b6d7657445edda71e5.png

d. Check whether the local computer has a network connection. I won’t go into details here. If the local computer cannot connect to the Internet, the virtual machine cannot connect to it, and it is impossible to ping.

e. Check DNS resolution, ping 114.114.114.114, 8.8.8.8, 223.5.5.5. If you can ping, but cannot ping www.baidu.com , there is a problem with DNS resolution. Enter the following code in Xshell, Check whether the DNS configuration is successful. This method can also check the local IP, subnet mask, gateway and other information.

cat /etc/sysconfig/network-scripts/ifcfg-eth0
71c297269a97a38785640f0fa328f911.png

This ends the idea, which basically solves the problem of the virtual machine being unable to connect to the network and being unable to ping the external network.

 


I am koten, I have been in operation and maintenance for 10 years, and I continue to share useful information on operation and maintenance. Thank you all for reading and paying attention!

 

Guess you like

Origin blog.csdn.net/qq_37510195/article/details/129186892