Solve the problem by manually configuring the ip address of the local Vnet8 virtual network card: the local host xshell cannot connect to the virtual machine Centos7

Xshell used to connect to the virtual machine smoothly before, but suddenly it couldn’t connect to it one day, which really offended my little temper;

-For the virtual machine system, I did the following necessary work:

1. The virtual machine network connection settings cancel the dynamic allocation of IP addresses, and the NAT mode is selected;

2. The Cento7 system even assigns IP addresses manually;

3. The firewall is also turned off (systemctl stop firewalld /systemctl status firewalld);

4. SElinux is also closed (setenforce 0);

5. The SSH service has also started on port 22 (netstat sshd |grep ssh);

There is no mistake in these configurations.

-Back to local (mine is win10):

1. Checked xshell, the requested ip address and requested port are all correct

2. I also turned off the firewall, but the ip address of the virtual machine still cannot be pinged, and the corresponding host cannot be ssh connected.

Then after troubleshooting, I executed the ipconfig command through the local host command line, checked the IP address of the Vnet8 network card, and found the problem;

The actual Vnet8 network card IP address is a random and automatically obtained IP address and gateway, which is different from the network card configured by the virtual machine. As a result, when pinging the virtual machine locally, the packets are forwarded to other places and we only need to change it manually Configure the Vnet8 virtual network card.

Now that the network configuration file on the virtual machine is configured, we will write down these configuration information:

Then we select the Vnet8 virtual network card connection of the local host

Then we click on properties, select Internet Protocol Version (TCP/Ipv4), manually configure the IP address, gateway, and mask

xshell reconnects to the host, successful

Guess you like

Origin blog.csdn.net/weixin_31789689/article/details/108269684