Tuesday, August 05, 2008

Setup network bridge in Debian and RedHat Linux

We can setup a network bridge in Debian and Redhat systems using the following methods

In RedHat Linux do the following

First install bridge-utils using yum or rpm or utility you like

Remove the ip address of the ethernet interfaces. You need a minimum of two

Then issue the following commands

#> brctl addbr br0

#> brctl addif br0 eth0
#> brctl addif br0 eth1
#> ip link set br0 up

And the bridge is ready.

To set ip address to bridge you can use

#> ip addr add 10.1.1.18/16 brd + dev br0

To configure routing on that bridge use the following command. This sets default gateway

#> route add default gw 10.1.1.1 dev br0.

In Debian use the following commands

To install bridge-utils

aptitude install bridge-utils

Then issue following commands

auto br0
iface br0 inet static
bridge_ports eth0
address 192.168.10.10
netmask 255.255.255.0
network 192.168.10.0
broadcast 192.168.10.255
gateway 192.168.10.1

To make the change permanent you have to enter these commands (except the installing command) in rc.local file in the /etc directory (Redhat ) /etc/network/interfaces ( for Debian based systems).

The brctl comes with various options inlcuding stp and others. Read manpage for details.

Use

>#man brctl



6 comments:

  1. In Debian, you put all those commands in /etc/network/interfaces NOT /etc/rc.local

    ReplyDelete
  2. Yes, Thanks for the correction..

    ReplyDelete
  3. Anonymous6:40 AM

    Creating a bridge with only one port (via "bridge_ports eth0" in /etc/network/interfaces, as per your example) isn't very useful.

    This should be amended to "bridge_ports all" or specify the relevant interfaces to be used, eg. "bridge_ports eth0 eth1".

    More information on this is available in /usr/share/doc/bridge-utils/README.Debian.gz (Etch) or within the bridge-utils-interfaces(5) man page (Lenny).

    ReplyDelete
  4. Anonymous4:21 PM

    Can anyone recommend the well-priced Managed Service program for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central remote windows login
    ? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

    ReplyDelete
  5. Anonymous1:26 PM

    I truly believe that we have reached the point where technology has become one with our society, and I am 99% certain that we have passed the point of no return in our relationship with technology.


    I don't mean this in a bad way, of course! Ethical concerns aside... I just hope that as technology further develops, the possibility of copying our brains onto a digital medium becomes a true reality. It's one of the things I really wish I could see in my lifetime.


    (Posted on Nintendo DS running [url=http://kwstar88.livejournal.com/491.html]R4[/url] DS QDos)

    ReplyDelete
  6. "Remove the ip address of the ethernet interfaces"

    is this necessary ?

    ReplyDelete