Archive for the ‘Virtualization’ Category

Virtualbox uses a NAT network connection by default. So initiating an SSH connection to the guest machine from either the host machine or any other box is impossible. A work around for this is to forward all packets coming to a port on the host machine to the port on which the ssh server listens on the guest machine. This can be done using the “VBoxManage” Virtualbox command. Assuming the host port is 2022, ssh server listens on the default port 22 and the network adapter is a PCnet. The guest machine runs Mepis Linux and is named mepis01.

Type the following commands on the host machine’s console

>> VBoxManage setextradata mepis01 “VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort” 2022

>> VBoxManage setextradata mepis01 “VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort” 22

>> VBoxManage setextradata mepis01 “VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol” TCP

You need to close and restart the host machine before the changes take effect.

You can now connect through ssh from the host machine as:
>> ssh -l daysen -p 2022 localhost

Replace localhost with the IP address or hostname of the host machine if you are connecting from another box