Use Xshell in host Win7 to access the virtual machine Ubuntu.

Source: Internet
Author: User
Tags ssh server

Environment:

Host: Win7 32-bit;

Virtual machine: Ubuntu 11.04. 32 Guests

vbox:4.2.8

1, configure the network: Host-only and Nat Two way > realize the virtual machine can access the extranet, and the virtual machine and the host form a LAN that can access each other.

Reference: http://blog.csdn.net/xinghun_4/article/details/7969894

After the virtual machine is installed, by default the network connection via Nat (1), in which case the virtual machine can surf the internet normally, but cannot communicate with the host.

All we need to do is enable the second network interface and change the interface to Hostonly mode (2). The purpose of this interface is to communicate with the host. After the VBox is installed, the physical host system automatically generates a network card (VirtualBox host-only Network)(3), and by default the network card IP is 192.168.56.1, remember to make sure that the network card is set to Enabled.

After the virtual machine is started, there will be two network cards, one is the original network card, the IP address will normally be 10.0.2.x, this network card is connected to the host by Nat, mainly used to access the network, in addition there will be a new network card appears, the network card IP is set to 192.168.56.x, The gateway is set to 192.168.56.1, the network card is used to communicate with the physical machine. 4

After a set-up, the virtual machine should be able to be accessed by the physical machine via IP and can access the network at the same time. Note In this configuration mode, if the physical host is within a LAN, then the other LAN host is not reachable through IP. (If you need other hosts in your LAN to access the virtual machine, you will need to change the virtual machine's network connection from host to bridged Adapter, and select the physical host's physical network interface as the Access interface.) If the network obtains IP through DHCP, then the virtual machine can obtain an IP address equivalent to the physical machine, as if a new physical machine were to be connected to the LAN. If there is no DHCP, then manually set a physical host equivalent IP address, you can also get the same effect. )

Host and virtual machines ping each other

Ping 192.168.56.1

Ping 192.168.56.102

If you still can't ping each other, turn off the firewall for the host and virtual machines.

2, Ubuntu 11.04 on the check and install SSH

If on the basis of 1, the two sides are ping to each other, the host with Xshell log on the virtual machine, or will appear the following error:

Could not connect to ' 192.168.56.102 ' (port): Connection failed

Because Ubuntu type does not have SSH server side.

First check if SSH is installed.

dpkg--list|grep SSH

found that in fact Ubuntu 11.04 has been installed by default client, so we just install the server is OK, if not installed, try this command:

#sudo Apt-get Install Openssh-client

Install the server-side Servers command (note 1)

#sudo Apt-get Install Openssh-server

To start the SSH service:

#sudo/etc/init.d/ssh Start

To stop the SSH service:

#sudo/etc/init.d/ssh Stop

To restart the SSH service:

#sudo/etc/init.d/ssh Restart

After you start SSH, you can use Xshell login utuntu to view the code.

Note 1: A, when executing the sudo apt-get install openssh-server instruction, there are sometimes errors that do not get the package, prompting the need to update the Apt-get update.

B, execute sudo apt-get update, the following error error occurred: (Reference: http://blog.csdn.net/chaihuasong/article/details/17009641)

404 Not Found [ip:91.189.91.14 80]
ERR http://security.ubuntu.com natty-security/restricted Sources
404 Not Found [ip:91.189.91.14 80]
ERR http://security.ubuntu.com Natty-security/universe Sources
404 Not Found [ip:91.189.91.14 80]
ERR http://security.ubuntu.com Natty-security/multiverse Sources
404 Not Found [ip:91.189.91.14 80]
ERR http://security.ubuntu.com Natty-security/main i386 Packages
404 Not Found [ip:91.189.91.14 80]
ERR http://security.ubuntu.com natty-security/restricted i386 Packages
404 Not Found [ip:91.189.91.14 80]
ERR http://security.ubuntu.com Natty-security/universe i386 Packages
404 Not Found [ip:91.189.91.14 80]
ERR http://security.ubuntu.com Natty-security/multiverse i386 Packages
404 Not Found [ip:91.189.91.14 80]

The workaround is: Find a lot of sources can not find, need to re-find the update source, and finally replace the address in the/etc/apt/sources.list file with the following 163 content:

Deb Http://mirrors.163.com/ubuntu/lucid main restricted universe Multiversedeb http://mirrors.163.com/ubuntu/ Lucid-security main restricted universe multiversedeb http://mirrors.163.com/ubuntu/lucid-updates main restricted Universe Multiversedeb http://mirrors.163.com/ubuntu/lucid-proposed main restricted universe Multiversedeb/HTTP Mirrors.163.com/ubuntu/lucid-backports main restricted universe multiversedeb-src http://mirrors.163.com/ubuntu/ Lucid main restricted Universe multiversedeb-src http://mirrors.163.com/ubuntu/lucid-security main restricted universe MULTIVERSEDEB-SRC http://mirrors.163.com/ubuntu/lucid-updates main restricted universe MULTIVERSEDEB-SRC/HTTP mirrors.163.com/ubuntu/lucid-proposed main restricted universe multiversedeb-src http://mirrors.163.com/ubuntu/ Lucid-backports Main restricted Universe multiverse

Found this source super fast, is NetEase 163 update server, pro-test available. The domestic source is the Ox x

C, and then back to sudo apt-get install openssh-server The following problems appear:
Openssh-server:depends:openssh-client (= 1:5.3p1-3ubuntu7.1) but 1:5.8p1-1ubuntu3 was to be installed

The workaround is: sudo apt-get install openssh-client== 1:5.3p1-3ubuntu7.1

Reference: http://www.cnblogs.com/xiaowenhu/p/3185631.html

Back again: sudo apt-get install openssh-server became executed.

Use Xshell in host Win7 to access the virtual machine 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.