When a virtual machine CENTOS6 network connection uses NAT mode, because the host IP is shared, the IP address of the virtual machine and the 22 port are not able to connect to the virtual machine when the Xshell is used.
This will require the port mapping relationship to be configured!
1. Open the Virtual network editor
2. Click Change settings
Select VMnet8 Click Nat Settings
3. Click Add
4. Host port number is located between 1024~65535, I choose 2345 port, Virtual machine address is the virtual machine CentOS IPV4 address, the virtual machine SSH default port is 22
5. Click OK until you exit Setup page 6. Sometimes you need to set up local Internet Connection Sharing
Control Panel-Network and Sharing Center or Network icon right-property
Then click on the left to change the adapter settings
Right-click Local Area Connection-properties-Share
Finally all the way to determine the exit settings, restart the virtual machine, networking try it.
Virtual Machine Network connection NAT mode, local with Xshell connection