Ubuntu Bridging Network Interfaces

Hello all,

I have recently been struggling with configuring an Ubuntu server to allow bridging network interfaces. I had one working long ago on another test machine, but it was overwritten with a new install. That being said, for quite some time today I researched this and never really found an answer. I did however find a few websites that eluded to possible methods for doing this. After piecing said methods together, I managed to bridge four Ethernet ports together.

All that being said,

=Here's what I needed to do...= I have four ethernet ports on this awesome quad core xeon processor (hehe...I have to brag a little bit at least) powered server. One port plugs into the switch and provides the box with access to the interwebz. Another port goes to another server, supposing to bring the int3rw3bz to that box as well. The third port goes to a wireless router, providing wireless access to the 1nt3rw3bz.

Let's see how poor my spelling of 1nt3rw3bz can get by the end of this...

=Example Assumptions= You have at least two network adapters. In this case I have four Ethernet adapters. This post will be working with those four.

=How to do It= Run sudo apt-get update

to make sure that all of your repositories know of the latest software.

After that, run sudo apt-get install bridge-utils This will install the necessary software to seamlessly bridge network interfaces.

Now...

Using your favorite text editor, crack open /etc/network/interfaces

sudo vim /etc/network/interfaces If you haven't done any manual customization of network interfaces yet, you should see something like...

auto lo iface lo inet loopback After this entry, type in

auto iface inet dhcp bridge_ports For my specific situation, I used...

auto br0 (or auto ) iface br0 inet dhcp bridge_ports eth3 eth0 eth1 eth2 After that, type

sudo /etc/init.d/networking restart

... and that will bring online your bridge along with all the bridged ports.

If you need your box to have a statically assigned ip address, don't assign it to the interface with the physical internet connection (in my case, eth3). Instead, assign it to the bridge itself.

In a situation like mine, your bridge interface would look like...

auto br0 iface br0 inet static address 10.0.1.185 netmask 255.255.255.0 network 10.0.1.0 broadcast 10.0.1.255 gateway 10.0.1.1 bridge_ports eth3 eth0 eth1 eth2 There you have it. A network bridge between as many interfaces as you want (or at least the four I tested it with). This of course will work with wireless interfaces as well, such as bridging an ethernet port to a wireless connection, essentially allowing a machine physically connected to a computer with wireless to not have to physically be connected to a wireless router (internet comes in through the wireless card and piped through to the ethernet port).

Happy bridging everyone!