BTW, bridged networking works. It's explained in their manual. It's slightly more complicated to setup than in VMware though. I wish they'd integrate this functionality automagically somehow so that as a user I don't have to bother about this ... On the positive side I'd have to mention though that it's all done with Linux system utilities. So what follows here is taken from Innotek's manual:
For bridging to work you need two additional packages:
1.)
uml-utilities
2.)
bridge-utils
Bridged networking or "Host Interface Networking" as they call it is achieved via the utilities
tunctl and
brctl, together with
ifconfig.
So what they basically do is to create a
TAP device, either dynamically or static, define a bridged interface and then set the real interface into promiscuous mode so that bridging works and packets may pass through.
All this stuff requires root priviledges though, so it's maybe a good idea to configure
sudo so that it doesn't ask you about a password everytime you want to do this.
Another idea of course could be to put that into an init script. VMware too uses some init scripts, so why not. If you know you will be using VirtualBox a lot and that you will need bridged networking for your VM's ... why not?
Example for
Static TAP:
Code: Select all
#! /bin/bash
# create a new tap device ... probably this will be tap0
/sbin/tunctl
# create a new bridged interface br0
/sbin/brctl addbr br0
# make sure eth0 is promiscuous
/sbin/ifconfig eth0 0.0.0.0 promisc
# add bridge br0 to real interface eth0
/sbin/brctl addif br0 eth0
# tell the bridged interface to get its address via DHCP
/sbin/dhclient br0
# bring everything together ...
/sbin/brctl addif br0 tap0
After that you can define tap0 as your bridged interface for your VM, and voila, your VM will appear on your LAN with its own DHCP-assigned IP address.
Dynamic TAP is slightly more complicated. The VBox manual divides this into multiple smaller sections, and I'd put some of this into init scripts so I don't have to bother with it more than once.
For example, they suggest to check the permissions of
/dev/net/tun every time you want to use dynamic TAP. How annoying. I'd rather put something like this into some init script (which runs as root anyway during boot so we don't need sudo) and then be done with it:
Code: Select all
chgrp vboxusers /dev/net/tun
chmod g+rw /dev/net/tun
Then the real interface and bridging need to be prepared similar to the example above. I'd put this too into an init script so I don't have to bother with it more than once:
Code: Select all
#! /bin/bash
/sbin/brctl addbr br0
/sbin/ifconfig eth0 0.0.0.0 promisc
/sbin/brctl addif br0 eth0
/sbin/dhclient br0
Now we need to write start scripts and kill scripts which take the interface name we want to create as argument ... There is a section in the VM's network configuration where you would put this info, and hence TAP interfaces would be dynamically created or destroyed, depending if you powerup or shutdown a VM which is using this.
dynamic_tap_start.sh Code: Select all
#! /bin/bash
sudo /sbin/ifconfig $2 up
sudo /sbin/brctl addif br0 $2
dynamic_tap_kill.sh Code: Select all
#! /bin/bash
sudo /sbin/brctl delif br0 $2
I agree that this might look a bit frightning, but basically you can copy & paste this stuff and you're done. With all the stuff in place VBox is very easy to use. And given that it offers better speeds than VMware I'd say it's worth this little hassle.