Why? Well, I happen to use a lot of virtualization tools at work. In fact, I use Sun VirtualBox to run Solaris and Windows VMs for testing things, and I also make a lot of use of dynamips, a MIPS architecture hardware emulator made to emulate Cisco routers (I also occasionally make use of QEMU and derivitaives of it to emulate some odd ball hardware). Sometimes, it’s not enough to have these virtualized machines interact with the physical network through my host OS’s network stack. Sometimes, I want the disperate virtual devices to interact with one another, and with the physical network as individual machines. to do this, I need to create a virtual ethernet bridge and then create tap interfaces for the virtual devices.
Firs you need the bridge utils package installed. This provide the binary /usr/sbin/brctl. In Ubuntu this package is just called bridge-utils.
Everything else you need should already be installed with most Linux distros.
First, create a bridge interface:
brctl addbr br0
Second, remove the IP address from your usual Ethernet interface:
ifconfig eth0 0.0.0.0
Third, add the ethernet interface to the bridge:
brctl addif br0 eth0
Next, let’s get back on the physical network (assuming you use DHCP):
dhclient br0