The article is for your own study. If there are any mistakes, please correct me!
Author: rookiequ
Problem that xshell cannot connect to the virtual machine
When using xshell to connect to the Linux virtual machine locally, the error message Could not connect to '192.168.80.145' (port 22): Connection failed
solution:
- First make sure that the virtual machine is powered on
- Then open xshell, add the information of the Linux system to be connected: define the name, and write the IP address of the virtual machine to be connected to the host.
ifconfig
Check the IP address of the virtual machine through the command
- Then, I encountered such a problem, Could not connect to '192.168.80.145' (port 22): Connection failed . By querying various information, what firewall problems, ssh problems, etc., but I have configured these, So I won’t explain the solutions to the above problems first.
- My solution is: In VMware Workstation, -> Edit -> Virtual Network Editor -> Select Vmnet8 -> Change the configuration as an administrator, use nat mode, and then modify the subnets one by one (the subnet here is your Subnet common to the currently used cluster) –> After all modifications are completed, save. –>Reconnect.
Please refer to the figure below for the steps:
Success, problem solved. Then click OK, and then you will be asked to enter the username and password of the virtual machine (note: the username here is not the name of the virtual machine), so that you can use xshell to control the virtual machine.
Summary: Let me talk about the reason why I encountered this problem. Because in the previous practical training class, I built two different clusters. I only used the cluster built later. I left it for a long time without touching the virtual machine, and I forgot all the operations. It’s almost done. Now we are conducting a practical training course on big data, which requires files such as zookeeper, hadoop, hive, etc. However, there are not many cluster configuration files to be built later, only hadoop. Then I tried to use the first one, but couldn't connect. Not to mention nonsense, the subnet of the virtual network is not the subnet of the cluster to be used , so fail connected.