Bridged Networking with VirtualBox

I have been playing around Oracle 11g and Microsoft SQL Express inside of virtual machines. I wanted to be able host these databases to other computers in my LAN which meant the virtual machines needed an IP address on my subnet. I am using VirtualBox to host the virtual machines and unfortunately bridged networking (needed to make this work) is not setup when you install VirtualBox. However I found this walkthrough and I worked really well.

The guide is written for VirtualBox 1.6.2 but it worked fine for me in version 2.0.4.

http://samiux.wordpress.com/2008/07/30/bridging-virtualbox-162-on-ubuntu-8041/

For quick reference the basic steps are:

Install bridging utilities.

sudo apt-get install uml-utilities bridge-utils

Change the permissions of this file so others can access it.

sudo chmod 0666 /dev/net/tun

Add the bridge to the networking configuration (you can give the bridge device a static IP if need be).

sudo vim /etc/network/interfaces
auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

Restart networking.

sudo /etc/init.d/networking restart

Add a virtual network device to the bridge

sudo VBoxAddIF vbox0 `whoami` br0

Then you can in and assign the virtual machines networking configuration to Host Interface: vbox0. Something to note is that only one virtual network interface can be used at a time. So if you want two virtual machines to run at the same time using the bridge, you have to create additional ones (sudo VBoxAddIF vbox1 `whoami` br0, etc) and assign them to machines accordingly.

Leave a Reply

{
}