xshell cannot connect to virtual machine ip

The network configuration of my local virtual machine is as follows:

Command: vi /etc/sysconfig/network-scripts/ifcfg-ens32  

 Restart the gateway after the configuration is successful

Instruction: systemctl restart network

After the restart is successful, configure the virtual network editor of the virtual machine, the configuration is the same as that in the above figure

These configurations correspond to

Then edit the local network

The configuration is as shown below

 Note: The ip configured here cannot be the same as the ip configured by the virtual machine or the gateway ip. It can be in the same subnet segment as the virtual machine ip. For example, 192.168.10.100 in the above picture, the configuration here can be 2-254 in between.

Refresh dns after configuration, or update the configuration through the police network and then restart the network!

At this point, you can use xshell to face the virtual machine

 

Note: Be sure to turn off the virtual machine firewall and host firewall!

Summary: During the operation, I found that when using the same ip as the virtual machine to configure the local , using xshell to connect to the virtual machine always fails, telnet is different, and the error connection fails. Then I said that the ip of VMnet8 is configured to be the same as the gateway ip, and found that Telnet can be connected, and xshell can also be connected, but I found that the local machine (host) can ping the virtual machine, but the virtual machine can ping different hosts, and the virtual machine can’t connect to the external network (ping Baidu), so I changed it After looking at the ip configuration of VMnet8, change it to the same subnet as the virtual machine, but it cannot be consistent with the gateway ip and the virtual machine ip, and found that the problem has been successfully solved, xshell can connect to the virtual machine, and the virtual machine can also be connected Internet!

 

PEACE!

END

 

 

 

Guess you like

Origin blog.csdn.net/weixin_42767099/article/details/119216149