Your concern

In Debian 5.0 you would like to set up an Ethernet bridge which combines all of your Ethernet cards. Packets received from one card should be forwarded to the others, unless the packets are for the computer itself. Thus these network cards should work in a similar way to a switch or bridge.

You also want a solution that sets up the bridge correctly on every reboot (not just a call to brctl).

Note:

You need such a bridge, for example, to set up virtual hosts which can access the LAN under XEN or VirtualBox.

The procedure

The Debian package bridge-utils contains an extension for the file /etc/network/interfaces. Instead of eth0 you define a device br0. With the new keyword bridge_ports you define which network cards are to be bound to this bridge. The special keyword all binds all existing LAN cards to the bridge (these cards themselves must not be listed in interfaces).

The following example shows a configuration with a bridge and a static IP configuration:

/etc/network/interfacesauto lo br0
iface lo inet loopback

# The primary network interface
iface br0 inet static
    address 10.10.1.1
    netmask 255.255.0.0
    gateway 10.10.0.66
    bridge_ports all

After a reboot, or after a ifup br0, the bridge br0 will be available as a new network card. The command brctl show displays the bridge:

user@linux> brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.00248c24f2af       no              eth0

From now on, network traffic no longer goes directly via eth0, but instead officially via br0. If you refer to eth0 in shell scripts etc., you may have to change this to br0.

Linux knowledge

These articles were written by the founder of Checkmk many years ago.
They are still valid though and thus we keep them on our website.
Mathias has since then developed a monitoring software called Checkmk

Find out more