Network bridge

Introduction
A network bridge can be used to connect two independent network segments at layer 2 level (much like a router). Common applications include transparent proxying, transparent filtering (using iptables) and saving money on hardware as some mainboards come with two PHY interfaces. For this how-to, eth0 and eth1 are used but of course they can be replaced by whatever you need.

The way bridging works on Linux is that a bridging device is created (brX) that contains at least two network devices as ports (e.g. ethX or pppX). As the bridge works on layer 2, no IP addresses are needed on the port devices - on a typical setup, the bridging device itself will receive the IP (e.g. via DHCP).

Installation
Install :

Host Configuration
First, we need to add the bridge device to the file. As an example, bridge configuration with DHCP:

More documentation can be found in.

Next, create the init script and start the interface as follows:

Finally, to make sure the bridge is automatically set up on subsequent boots, run:

External Resources

 * Official Linux network bridge documentation
 * Generic Linux network bridge how-to
 * Article on the inofficial gentoo wiki with VLAN and iptables examples