Configuring a VirtualBox VM using NAT so you can SSH to it


Assuming you've setup the VM with NAT but assigned a static address to it, use this command to make it possible to connect to the VM via ssh:

VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,10.0.2.15,22"

Then you can run 'ssh -p 2222 localhost'.

See http://www.virtualbox.org/manual/ch06.html#network_nat for more info.

10/19/2011