Solution of unable to Ping VM CentOS system under win

Time:2020-8-1

Event description: when the company moves to a new address, after the computer takes it, it always fails to connect to the CentOS system of VM with xshell. Then, considering the situation of the company moving to the new address, I first suspect that it is the IP problem. Then I execute ifconfig in VM to find the CentOS IP and take it to the middle of windows to execute the ping command. Of course, Ping fails.

Analysis reason: because I don’t have a lot of contact with Linux, I usually use it as a test when I develop it. So, in the face of this problem, I can’t analyze the reason myself. So, Baidu, netizens give the reason that: after IP changes, VM IP and windows IP may not be in the same network segment, so the connection fails.

Solution: after knowing that the reason is that IP is not in the same network segment, it is easy to solve the problem by configuring it to the same network segment. For example, the IP of my CentOS is 192.168.1.110, while that of windows is 192.168.10.11. Then I can change the IP of CentOS to 192.168.10. X (X represents the number of 0-255).

Therefore, execute ipconfig under windows to find the IP address of windows, and then execute VI / etc / sysconfig / network scripts / ifcfg-eth0 in VM to modify the relevant configuration of network card. After saving and exiting, execute service network restart to make the new network card configuration take effect. Then run ping command again under Windows, and the test is successful.