Sunday, January 6, 2008

Ethernet Bridge

A bridge is a way to connect two Ethernet segments together in a protocol independent way. Packets are forwarded based on Ethernet address, rather than IP address (like a router). Since forwarding is done at Layer 2, all protocols can go transparently through a bridge.

Bridging is supported in the current Linux kernels (2.4 and 2.6) from all the major distributions. The required administration utilities are in the bridge-utils package in most distributions.

Setup an Ethernet bridge in Debian

  1. Install two Ethernet LAN cards in a PC with Debian installed. The original LAN card is named "eth0" and the newly installed LAN cards are named "eth1" and "eth2".
  2. Install the bridge administration tools:
    # apt-get install bridge-utils
  3. Setup a bridge between eth1 and eth2 by the following commands:
    # ifconfig eth1 0.0.0.0
    # ifconfig eth2 0.0.0.0
    # brctl addbr br0
    # brctl addif br0 eth1
    # brctl addif br0 eth2
    # ifconfig br0 up
http://www.linux-foundation.org/en/Net:Bridge