This covers how to bridge connections using the package bridge-utils. It is assumed that the bridging computer is not directly connected to the Internet. This article contains information from several sources, including;

Please visit these sites if you need a more in-depth discussion of network bridges and the commands used here.

Why bridge?

It is possible to "bridge" two Ethernet adapters together (for example, eth0 and eth1). When you bridge two Ethernet networks, the two networks become one single (larger) Ethernet network.

One reason you would bridge Ethernet connections is to monitor traffic flowing across an Ethernet cable. For example, an inline sniffer to monitor the traffic flowing between these two devices, such as a router and the switch. (Using tools like ntop, Wireshark, and tcpdump.)

How to bridge? (short version)

The Debian wiki provides a good overview of how to use brctl and the /etc/network/interfaces file to create and set up bridges. Typing man bridge-utils-interfaces at a command prompt provides additional detail.

You can set up a simple Ethernet bridge by installing bridge-utils placing this text into /etc/network/interfaces file:

Using auto br0 ensures that the bridge starts when the computer reboots, and using iface br0 inet dhcp provides the computer with its own IP address on the single (larger) Ethernet network.

You will note that auto eth0 and iface eth0 inet manual are not in the file. This is because br0 will bring up the components assigned to it.

Once you have edited the /etc/network/interfaces file, it may be easiest to reboot your computer to turn on the bridging. (It is possible to start the bridge without rebooting or logging out, but you may have some problems with the Network Connection Manager interfering with your settings.)

Bridging Ethernet Connections from the GUI

Bridging Ethernet Connections (Step by step)

You will need to know the following information;

Your interface name. This used to be eth0 or eth1, but now we have Predictable Network Interface Names which means they could be eth0, p3p1, p2p1, enp9s0, wlp9s0, or eno16777728. (Yes, those are all real examples. Do an ifconfig from the cli to find out what Ubuntu is actually calling your nics.

Your IP address, subnet mask, gateway and DNS. (If not using dhcp)

Information about your network. (Specifically if a loop could ever be formed.)

Installing bridge-utils

sudo apt-get update
sudo apt-get install bridge-utils

If you use sudo -iand enter your password, then you will not have to use sudo before each command. It may also save you some typing in the future.

Automatically Create the Bridge at Start-up

The above setup demonstrated how to create a bridge using the command line, however when you restart your computer you will lose it. To prevent this from happening, we need to edit the /etc/network/interfaces file. This file shows an example of a bridge configure via dhcp.

bridge_stp off is a setting for spanning tree. If you have a possibility for network looks, you may want to turn this on.

bridge_fd 0 turns off all forwarding delay. If you do not know what this is, you probably do not need it.

bridge_maxwait 0 is how long the system will wait for the Ethernet ports to come up. Zero is no wait.

Manually Setting up the Bridge

If you do not want to use your bridge all the time (or if you do not want to break Network Manager for the times when you are not bridging) you can build a bridge by hand. Or you can script it to bring up your bridge on demand.

Ensure that both (or all) of your interfaces are installed and enabled. If they are then you may proceed at this point. For a few moments, if your computer is connected to the Internet then it will be disconnected temporarily.

Open a terminal and use the following commands. Note that when interfaces are referenced, they refer to device names assigned by Linux such as "eth0" and "eth1". A bridge can be anything, but a simple name like bridge0 or br0 is suggested.

In lines 1-2 we simply prepared the devices to be bridged. In line 3, we added a new bridge named myBridge (whatever you named your bridge). In lines 4-5, we added interface1 and interface2 to myBridge. In line 6, we made the bridge operational. For more information on commands: use the Konsole command brctl

Manually creating the routing

If you manually created the bridge above, you will also need to manually give it IP address information. If you are using DHCP, running sudo dhclient br0 will get your interface up and running. If not, it is all manual.