How to connect to the Virtual Machine Network Using ssh

Source: Internet
Author: User

Use ssh to connect to the Virtual Machine network:
Host windows xp Virtual Machine virtualbox with a redhat Enterprise 6 Network: Virtual Machine with NAT connection method www.2cto.com NAT refer to http://baike.baidu.com/view/16102.htm
After the preceding settings, the VM can access the Internet through the host. But how do hosts access virtual machines?
1. in the company's Lan, the virtual machine sets an available ip address, and the network settings are the same as the host (the ip address is different, the other is the same) 2. if there is no LAN environment, you need to use the port foring method (port forwarding) principle can refer to the http://www.bkjia.com/ OS /201202/119950.html to say that is, access a port of the local machine, it will be directly forwarded to a port corresponding to the virtual machine, such as port 22 of the host corresponding to port 22 of the Virtual Machine. At this time, I access the ip address of the Host: 22, which is equivalent to accessing the ip address of the virtual machine: 22. Set port ing:
After virtualbox uses nat, a network connection with the ip address 192.168.56.1 will appear on the host:

At the same time, the virtual machine's Port Forwarding sets the ing relationship: www.2cto.com
Ssh connection configuration: Set the ssh ip address to the Host ip address, that is, 192.168.56.1, and port 22. As you can imagine, this connection actually accesses port 22 of the VM. Which port is used by the host (not necessarily the same as the virtual machine port), not necessarily 22, but the virtual machine is port 22 because it is an ssh service. That is to say, the host can use port 400 to map to port 22 of the VM.

Connection successful!


Author: flysnowxf

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.