In this post I’ll show how to configure a VirtualBox appliance with bridge network on a Gentoo linux.
First, we’ll need tunctl to create a TUN/TAP device and brctl to setup a ethernet bridge:
emerge sys-apps/usermode-utilities
emerge net-misc/bridge-utils
Now, just add the lines bellow to your /etc/conf.d/net:
#################### # VirtualBox Bridge #################### config_eth0="null" tuntap_vbox0="tap" tunctl_vbox0="-u <user>" config_vbox0="null" rc_need_br0="net.vbox0" bridge_br0="vbox0 eth0" config_br0="172.16.1.2/24" routes_br0="default via 172.16.1.1" brctl_br0="setfd 0 sethello 0 stp off"
- Change “<user>” by the your user, i.e., the user that will use the VirtualBox.
- The host machine (your Gentoo linux) will assume the IP address 172.16.1.2
- If you have more than one vbox appliance that you want to use in bridge mode, just create an additional interface (vbox1, vbox2, etc) configuration to each vbox host and include these interfaces to the variable bridge_br0
Create a symbolic link to these new interfaces (vbox0 and br0):
ln -s /etc/init.d/net.lo /etc/init.d/net.vbox0
ln -s /etc/init.d/net.lo /etc/init.d/net.br0
Start the new interfaces:
/etc/init.d/net.vbox0 start
/etc/init.d/net.br0 start
Check if the following lines are included in /etc/modules.autoload.d/kernel-2.6:
vboxdrv vboxnetflt vboxnetadp
After all infrastructure configuration, now we’ll configure the vbox appliance. Open the VirtualBox program, select the appropriate appliance, go to “Settings“ and change its newtork settings:
Attached to: Bridged Adapter
Name: vbox0
It’s exemplified in figure bellow:
Now, you can boot the appliance and configure its IP address inside the range (172.16.1.3-172.16.1.254) and access it from the host machine (your Gentoo linux).
Note: this procedure was tested only on VirtualBox 3.1.6








