I have installed Ubuntu Server on a virtual machine in VirtualBox which runs on Windows 7. How can I connect through ssh to that virtual machine?
I go and type 'ifconfig', and i get this address "10.0.2.15". But when I try ssh 10.0.2.15
it can't establish the connection.
The easiest way is to set up the network interface of the virtual machine to "Bridged mode" in virtualbox.
You do that by selecting the virtual machine (in VB) then go to
settings > network
, and change theattached to
dropdown fromNAT
tobridged
After that, you virtual machine should get an IP address of your local network (similar tot he one of the host pc) and you should be able to ssh it with that IP.
You can achieve this by forwarding ports to the virtual machine.
Make sure your virtual machine has
openssh-server
installed and running!Click the icon in the top right which has a plus (+) symbol to add a port forwarding rule and enter the following data:
Note that the host port is not the usual
ssh
port of 22.Now you can ssh into your virtual machine!