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,,22"

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

See for more info.