Setting up a Debian bridge

Using Debian squeeze, I setup a bridge between two interfaces (eth1 and eth2) using the following instructions. Note that eth0 is the management interface.

Install bridge utils

sudo apt-get install bridge-utils

Edit /etc/network/interfaces

sudo nano /etc/network/interfaces

  1. # This file describes the network interfaces available on your system
  2. # and how to activate them. For more information, see interfaces(5).
  3.  
  4. # The loopback network interface
  5. auto lo eth0 eth1 eth2 br0
  6. iface lo inet loopback
  7.  
  8. # The primary network interface
  9. iface eth0 inet static
  10.         address 10.1.0.73
  11.         broadcast 10.1.0.255
  12.         netmask 255.255.255.0
  13.         gateway 10.1.0.254
  14.  
  15. iface eth1 inet static
  16.         address 0.0.0.0
  17.         broadcast 0.0.0.0
  18.         netmask 255.255.255.0
  19.  
  20.  
  21. iface eth2 inet static
  22.         address 0.0.0.0  
  23.         broadcast 0.0.0.0    
  24.         netmask 255.255.255.0
  25.  
  26. # Bridge setup
  27. iface br0 inet static
  28.         bridge_ports eth1 eth2
  29.         address 169.254.2.2
  30.         broadcast 169.254.2.255
  31.         netmask 255.255.255.0
  32.         gateway 169.254.2.1
  33.  
  34. # Bridge OPTIONS
  35. bridge_ports eth1 eth2
  36. bridge_stp off
  37. bridge_waitport 0
  38. bridge_fd 0

Now you need to edit /etc/sysctl.conf and uncomment these dirrectives

sudo nano /etc/sysctl.conf

  1. net.ipv4.tcp_syncookies=1
  2.  
  3. # Uncomment the next line to enable packet forwarding for IPv4
  4. net.ipv4.ip_forward=1
  5.  
  6. # Uncomment the next line to enable packet forwarding for IPv6
  7. #  Enabling this option disables Stateless Address Autoconfiguration
  8. #  based on Router Advertisements for this host
  9. net.ipv6.conf.all.forwarding=1

Next, edit rc.local and add the following:

sudo nano /etc/rc.local

  1. /etc/init.d/procps restart
  2. ifup eth0
  3. ifup br0
  4. iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

Reboot your box and you should be good to go :)

Blog tags: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.