I had written a message about bridging VirtualBox in my blog. However, it is out-dated. I will show you how to do it on Ubuntu 8.04.1 with VirtualBox 1.6.2.
The steps I mentioned here is assumed that the host system is behind a router and the ip addresses are distributed by DHCP from the router.
Step 1 :
Install the required package for the bridged network on the host.
sudo apt-get install uml-utilities bridge-utils
Issue the following command to stop the network interface.
sudo invoke-rc.d networking stop
Edit the /etc/network/interfaces by the below command.
sudo nano /etc/network/interfaces
The content of the file should be like this. That is, append the line of ‘auto br0′ and the rest to the end of /etc/network/interfaces. The codes are for bridging eth0 and you can change it as required.
iface lo inet loopback
iface eth0 inet manual
iface br0 inet dhcp
Restart the network interface.
sudo /etc/init.d/networking restart
Step 2 :
Still on the host. Issue the following commands.
sudo VBoxAddIF vbox0 `whoami` br0
VBoxManage modifyvm "My VM" -hostifdev1 vbox0
sudo chmod 0666 /dev/net/tun
* where “My VM” is the name of your guest. The network interface should be Host Interface.
Make sure, at the GUI VirtualBox panel, select “Network”, Select “Host Interface” at “Attached to” and fill in the blank to “vbox0” at “Interface Name”.
Updated on 2009-FEB-22 :
This HOWTO is out-dated when VirtualBox 2.1.0 is out! The current version is 2.1.4 as at today. The current version of VirtualBox handles the network interfaces bridging automatically.