How to setup network bridge

I have written following tutorial based on my system(Debian). It may work with little or no modification in your system too.

First of all what is a network bridge?
According to www.linux-foundation.org
A bridge is a way to connect two Ethernet segments together in a protocol independent way.
I assume if you are reading this then you must know lot more than this.

So how do we create a bridge then? In windows it is very simple, just select the interfaces, right-click them and select create bridge.

In Linux, you need to do it following:

Edit your /etc/network/interfaces file
vi /etc/network/interfaces

Add the following codes
iface br0 inet static
address 172.16.5.1
netmask 255.255.255.224
gateway 172.16.5.5
bridge_ports eth0 eth1


OR

iface br0 inet dhcp
bridge_ports eth0 eth1


Save and exit.
Go to Terminal.
sudo ifup br0

Doing so will produce the following error

SIOCSIFADDR: No such device
br0: ERROR while getting interface flags: No such device
br0: ERROR while getting interface flags: No such device
wifi0: unknown hardware address type 801
Bind socket to interface: No such device
Failed to bring up br0.


This is because you haven't installed the package bridge-utils
In terminal type sudo apt-get install bridge-utils

Bingo! you are done.

If you want the bridge to be up automatically then you can add auto br0 in the /etc/network/interfaces file somewhere near the above added lines.

Comments

  1. how about firewalling that bridge?

    ReplyDelete
  2. thanks!
    is what i'm looking for

    ReplyDelete
  3. right post at right time thaks.

    ReplyDelete
  4. I ran into a situation with Ubuntu Server 10.04.1 LTS where after installing the prereqs for OpenVPN and trying to configure it that br0 would *not* go up no matter how many guides I followed. Finally I used apt to junk bridge-utils and reinstalled it. First try was a success. Don't know what changed in the repos but if anyone else has this problem following actual Ubuntu help guides this may help cure it.

    ReplyDelete

Post a Comment

Comments are moderated. No spam please.

Popular posts from this blog

Perm Root HTC Desire Gingerbread 2.3.3

Adobe Stand Alone Flash Player for Linux

Increase Free Space On HTC Desire Android Phones