another small problem with networking

David A. Bandel david
Mon May 17 11:43:02 PDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 07 Jan 2003 07:57:00 +1000
begin  Keith Antoine <kantoine at bigpond.net.au> spewed forth:

> At 05:55 PM 5/01/2003 -0500, you wrote:
> 
> 
> >If you want to know how to put both Win boxes on the same subnet using
> >the bridge tools, let me know and I'll provide you a short SxS.
> >
> >Ciao,
> >
> >David A. Bandel
> 
> I would appreciate that very much thank you, David.
> 

OK, sorry to take so long (kinda busy).

First a little theory so you understand what's going on.

Basically there are three networking devices: gateways, routers, and
bridges.  These are systems that normally have multiple interfaces.

For our (very limited) purposes, gateways and routers are the same (please
don't flame, I know better, but I want to talk about bridges) -- they
accept a packet on one interface and route it out another interface
depending on its destination.  Normally, they will have more than one
interface, but this isn't required (you can put one interface on two
separate subnets and route, but this is non-optimal and requires turning
off redirects).  These devices are visible as a "hop" in a traceroute.

Other systems that are neither routers, gateways, nor bridges can have
multiple interfaces to provide redundancy, massive parallel processing, or
for ethernet bonding (called Trunking by SUN or Etherchannel by Cisco) but
these are not considered here.

Bridges work a little differently.  A system used as a bridge will have
multiple interfaces.  Whereas in routers and gateways, each interface will
have one or more unique IP(s) on separate networks, a bridge combines
multiple interfaces into what looks like one interface.  This interface is
only visible when the system it is on is addressed directly.  Otherwise,
the bridging system is invisible in a traceroute when tracerouting from
one side of the bridge to the other.  That is, for all intents and
purposes, the bridge doesn't exist.

How does this work?  Well, let's say we have three interfaces on a system
- -- eth0 goes to the world, and eth1 and eth2 are bridged.

eth0 will have a unique IP on its network.  eth1 and eth2 will be combined
and called br0.  Neither will get a unique IP, but the bridge device will
get a unique IP.

Now eth1 and eth2 both have unique MAC addresses.  So when each are
connected to a different physical (but not logical) network segment, they
will listen for unanswered arp broadcasts on their physical network and
broadcast that arp request on the other physical network segment.  As the
bridge hears replies, it will learn on which physical segment each IP/MAC
pair is on and act accordingly.

So let's say you have:
Host foo: 192.168.0.2 connected to eth1 of the bridge (192.168.0.1, MAC
...:00)
Host bar: 192.168.0.3 connected to eth2 of the bridge (192.168.0.1, MAC
...:01)
(for simplicity, the first 5 duplets of the MAC address represented by
...)

when foo tries to talk to bar, it (foo) will first send an arp "who-has"
request.  the bridge will see it unanswered, so on the second or third
broadcast, it will duplicate the broadcast on its other interface (eth1 or
MAC ...:01).  bar will now see the arp "who-has" and reply.  The bridge
will pass the reply to foo and the two will communicate through the unseen
bridge as if connected to the same hub or switch.

In order to actually put the bridge into operation, you need support in
the kernel (Networking Options --> 802.1d Ethernet Bridging) as either
builtin or a module (I suggest a module).

Then you'll need the bridging tools (may or may not be available with your
distro).  The specific program you'll use is:  brctl (usually
/usr/sbin/brctl or /sbin/brctl)

To create a bridge, you first need to define the bridge:
brctl addbr br0

after running the above, if you run: `ifconfig -a` you'll see br0.

now you just need to add interfaces to it:
brctl addif eth1 br0

this adds the interface eth1 to br0.

add any other interfaces:
brctl addif eth2 br0

for more info see `man brctl`

After adding your interfaces, you treat br0 as you would eth0 by assigning
an IP to it:
ifconfig br0 192.168.0.1 ...

Note:  if you put another bridge on one of the bridged ethernet segments,
_don't_ play with the spanning tree protocol (stp) unless you know what
you're doing.

The Spanning Tree Protocol is used by interconnected bridges to find the
shortest, most efficient path between two systems.  They do this by
exchanging bridge protocol datagrams (if you use wireless APs that have
WDS, wireless distribution system, aka a wireless backbone, they'll make
extensive use of STP on
the WDS side).  If you alter the stp (and don't keep them in sync) your
network will suffer horribly and may stop working altogether.  STP
prevents looping and more.  Leave the defaults. 

Basically, the above is all there is to it (for a single bridge
consisting of two or more interfaces).

Note:  when a system first comes on the net, it may take a few seconds the
first time it tries to contact a system on the other side of the bridge,
but after the bridge learns the MAC/IP of the new system, subsequent
communications will be as fast as a directly connected system.

Questions?

David A. Bandel
- -- 
Focus on the dream, not the competition.
		-- Nemesis Racing Team motto
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+Hvfy3uVcotqGMQcRAh/fAJ48Q0PsAkVyPLO1Vnutor1UIEEJYACgrxaW
qK3H1iWOxzwmd21Obtw/IYY=
=Ikuz
-----END PGP SIGNATURE-----


More information about the Linux-users mailing list