Computers, Linux, Open-source, Software, Windows

VirtualBox NAT Tunneling

At work, we have database that you cannot connect to without using 802.1x authentication, or VPN. That sucks for my Virtual Machines, where I can’t used Bridged networking because of the requirements. Instead, I setup my host machine to use 802.1x, and pass this into the Virtual Machine using NAT networking.

You can issue commands to do tunneling from host to guest, as outlined by various websites. I am just old fashioned I suppose, and don’t like to blindly fire commands. I want to see what is being changed. I dug around a discovered the following (Windows host):

C:Documents and Settings.VirtualBoxMachines.xml

Substitute in your username, and Virtual Machine name. If the VM name has a space, or special character, you can quote the name in double-quotes.

This is where commands from “VBoxManage” are saved. In the following example, I am substituting in VM for the name of the VM, and Name is an arbitrary name that you label for your mapping. You can do this as many times as needed, provided that the name is unique. For example, if you wanted to share SSH from your host, you may choose “ssh” as the name of the configuration. Additionally, the ports don’t have to match up in the guest and host. You can see the result of the following VBoxManage commands:

cd "c:Program FilesSunxVM VirtualBox" (Windows only)
VBoxManage setextradata <VM> "VBoxInternal/Devices/e1000/0/LUN#0/Config/<Name>/Protocol" TCP
VBoxManage setextradata <VM> "VBoxInternal/Devices/e1000/0/LUN#0/Config/<Name>/GuestPort" 22
VBoxManage setextradata <VM> "VBoxInternal/Devices/e1000/0/LUN#0/Config/<Name>/HostPort" 2222



Now you can go in and change these commands and see the results in the file. Note that changing the file directly doesn’t affect the machine until a restart of the guest VM. Note also, that the network adapter referenced here as “e1000” refers to the Intel network driver. Check and make sure these match.

If you make a mistake creating the command, you can delete the command by issuing “VBoxManage” “VM” “Setting” without issuing a value for the setting. This blank value removes the XML line from the configuration file.


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s