- a RedHat system or some derivative using /etc/sysconfig/network-scripts
- a system with two or more network cards
- a Linux Kernel supporting network bridging
- the brctl command, comes with the bridge-utils RPM or can be downloaded from http://bridge.sourceforge.net/
After having checked these prerequisites identify the ethx names of the ethernet NICs that will comprise the bridge. Let's say we have a scenario where eth0 is our external interface and eth1 and eth2 will be our internal bridge. First, "null" these interfaces by editing their respective configuration files in /etc/sysconfig/network-scripts:
DEVICE=eth1 BOOTPROTO=none ONBOOT=yes
DEVICE=eth2 BOOTPROTO=none ONBOOT=yes
The interfaces will now get "empty" adresses on boot. Now let's edit the bridge interface:
brctl addbr br0 2&> /dev/null brctl addif br0 eth1 2&> /dev/null brctl addif br0 eth2 2&> /dev/null brctl stp br0 off 2&> /dev/null DEVICE=br0 ONBOOT=yes BOOTPROTO=static IPADDR=192.168.0.1 NETMASK=255.255.255.0
Now just run /etc/rc.d/init.d/network restart to bring up your bridge, and reconfigure filtering and routing scripts to act on the interface "br0" instead of what you had there earlier.
It's actually that simple. If you have more interfaces just list them after brctl addif br0 eth2. The redirect to /dev/null is because this is actually an ugly hack and as such will spew some errors when the network is restarted or stopped. The command brctl stp br0 off disables spanning tree protocol because we only need the simple switching functions of the bridge in this case.