pmeerw's blog

Fri, 24 Oct 2008

VirtualBox NAT with port forwarding

Using NAT in VirtualBox guests is straightforward, but when you want to access a network service provided by the guest, some additional setup is required.

While everybody seems to follow a moderately complex host interface / bridging configuration, there actually is a slick alternative (described in the Virtual Box user manual): NAT with port forwarding. Use the following commands on the host to configure forwarding of host port 2222 to port 22 in the guest.

VBoxManage setextradata "Linux Guest" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata "Linux Guest" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
VBoxManage setextradata "Linux Guest" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222
"Linux Guest" is the name of the virtual machine, guestssh is just an identifier describing the service.

posted at: 20:27 | path: /configuration | permanent link

Made with PyBlosxom