How to use SSH to connect to Ubuntu In the VMware Virtual Machine

Source: Internet
Author: User
Environment

VMWare Player 5.0.2, UBUNTU 13.10

 

VMware has three network connection modes:

 

1.Bridged (Bridging Mode): The Virtual Machine will directly connect to the physical LAN, so that it is independent from the host machine, get the IP address from the LAN router. In this way, the virtual OS can communicate with other terminals in the LAN. In Bridge Mode, the sub-option "Replicate physical network connection state. ", it means that if the Virtual Machine bridging mode is used on mobile devices such as laptops, when the host machine switches between the wireless network and the wired network, the virtual OS IP address is automatically updated without resetting.

 

2.NAT (network address translation mode): Virtual machines use network address translation to access the physical network through the shell host. The TCP/IP information of the virtual OS is automatically allocated by the vmnet8 network adapter established by the virtual machine on the host machine through DHCP and cannot be modified manually, therefore, the virtual OS can access other physical machines in the external physical network and network through the host machine, but the external physical machine cannot access the virtual OS through the external physical network.

 

3.Host-only (Host Mode): In this mode, only the host machine can communicate with the virtual machine, the Network TCP/IP information of the virtual OS is automatically allocated by the vmnet1 network adapter established by the virtual machine on the host.

 

PS: In bridged mode, the network adapter set up by the virtual machine is vmnet0, but according to practice, the Virtual Machine (VMware work station 9.0.2) does not create the vmnet0 adapter, the working status of the bridge mode is not affected.

 

 

Connect to virtual Ubuntu through SSH

 

The Virtual Machine selects the bridged mode, and uses the ifconfig command in Ubuntu to view the IP address allocated by the physical network. It should be in the same network segment as the host machine, for example, the routing gateway is 192.168.1.1, the IP address assigned to Ubuntu is 192.168.1.162.

 

In this case, the external terminal cannot access ubuntu. You can use SSH to test the connection: SSH [email protected] And get the error "SSH: connect to host localhost port 22: Connection refused ". The reason is that Ubuntu does not provide the SSH service by default, so first install the SSH service:

$ ssh apt-get install openssh-server

 

If the service is not automatically started after installation, start it manually:

$ sudo /etc/init.d/ssh start

 

In this case, other terminals in the network can use SSH to connect to Ubuntu.

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.