Accessing a virtual machine via SSH connection: Difference between revisions

From ICO wiki
Jump to navigationJump to search
(Created page with "Remotely accessing a device or server using SSH connection requires that this other device or server exists. If it does not, there is still a way to achieve this with the help...")
 
No edit summary
Line 5: Line 5:




1. Set up the Network of VirtualBox to [https://www.virtualbox.org/manual/ch06.html bridged adapter].
# Set up the Network of VirtualBox to [https://www.virtualbox.org/manual/ch06.html bridged adapter].
In ''Settings > Network > Adapter 1'' then select "Bridged Adapter" for the field "Attached to".
In ''Settings > Network > Adapter 1'' then select "Bridged Adapter" for the field "Attached to".
The bridged adapter mode will allow the host and the guest to have different network interfaces. It is like the two are connected with a network cable and they can send data to each other through this network.
The bridged adapter mode will allow the host and the guest to have different network interfaces. It is like the two are connected with a network cable and they can send data to each other through this network.
Line 12: Line 12:




2. Start the VM.
# Start the VM.




3. In Ubuntu, install SSH server to be able to use this type of connection.
# In Ubuntu, install SSH server to be able to use this type of connection.


  sudo apt-get install openssh-server
  sudo apt-get install openssh-server




4. Check what your guest's IP address is by running:
# Check what your guest's IP address is by running:


  ifconfig
  ifconfig
Line 27: Line 27:
   
   


5. On your host, run [http://www.putty.org Putty] and enter the guest's IP address to establish the connection.
# On your host, run [http://www.putty.org Putty] and enter the guest's IP address to establish the connection.

Revision as of 23:54, 30 September 2015

Remotely accessing a device or server using SSH connection requires that this other device or server exists. If it does not, there is still a way to achieve this with the help of a virtual machine. The idea is that a computer (the host) will remotely access via SSH another computer (the guest), the latter being a virtual machine (VM); meaning that practically, both host and guest are running on the same machine.

In the example below, host runs Windows 7, guest runs Ubuntu 14.04 using VirtualBox. It is assumed that the VM has already been created in VirtualBox.


  1. Set up the Network of VirtualBox to bridged adapter.

In Settings > Network > Adapter 1 then select "Bridged Adapter" for the field "Attached to". The bridged adapter mode will allow the host and the guest to have different network interfaces. It is like the two are connected with a network cable and they can send data to each other through this network.


  1. Start the VM.


  1. In Ubuntu, install SSH server to be able to use this type of connection.
sudo apt-get install openssh-server


  1. Check what your guest's IP address is by running:
ifconfig

The guest's IP address is the "inet addr" of "eth0". This is the IP that will be used to establish the SSH connection.


  1. On your host, run Putty and enter the guest's IP address to establish the connection.