Ubuntu – Virtualbox host to guest networking with NAT enabled

Ubuntuvirtualbox

I have guest Ubuntu operating systems installed in Oracle VirtualBox. I'm using Ubuntu 10.04 as the host(base) operating system with static public IP addresses.

I can access the Internet on guest(VirtualBox) OS only if I select the NAT as network mode in VirtualBox settings and this is fine, but host(base) to guest(VirtualBox) networking is not working.

I want to connect my guest OS from host via ssh.

I need a step by step guide.

Best Answer

I wrote a HOWTO for Linux Journal regarding port forwarding within NAT in VirtualBox here: http://www.linuxjournal.com/content/tech-tip-port-forwarding-virtualbox-vboxmanage

Use the VBoxManage utility to forward an unused local port (like 2222) to port 22 of the virtual machine (assuming that you are using the default port on the VM), which will easily allow you to SSH into your virtual machine.