Setting up post forwarding for VirtualBox on Ubuntu 10.04

Post forwarding for VirtualBox is quite simple once you know what you do (as always ;)).

  • Close the VirtualBox main window and shutdown all machines that are running. I found that VirtualBox overwrites the xml configuration files if you change them while it is still open.
  • cd to your virtual machine’s directory (default should be: ~/.VirtualBox/Machines/Name\ of\ Virtual\ Machine)
  • open the xml-File you find inside the directory, (your favorite editor should be the vi so enter:  vi Name\ of\ Virtual\ Machine.xml)
  • Add the following lines in between the <ExtraData> Tags to forward ssh-Traffic from port 2222 on localhost to port 22 on the virtual machine:
  •  <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/HostPort" value="2222"/>
    <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/GuestPort" value="22"/>
    <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/Protocol" value="TCP"/>
  • Open VirtualBox and start your virtual machine.
  • If VirtualBox complains about “Configuration error: Failed to get the “MAC” value (VERR_CFGM_VALUE_NOT_FOUND)” you have to change the network adapter your virtual machine is using. Go to Settings > Network > Advanced and change the network adapter to PCnet-FAST III.
  • Start the machine, wait for bootup, you should now be able to “ssh -p 2222 localhost” to your virtual machine.
  • Port forwarding for http and other services works similar.

I found the xml config on More info on networking in VirtualBox can be found on


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: