Bridging

 

Introduction

 

Bridging is a forwarding technique used in packet-switched computer networks. Unlike routing, bridging makes no assumptions about where in a network a particular address is located. Instead, it depends on flooding and examination of source addresses in received packet headers to locate unknown devices. A bridge is a device that connects two or more network segments within one logical network (e.g. a single IP-subnet). A bridge behaves like a network switch (i.e. Layer 2 Switch).

Now, lets see how routing and bridging can happen simultaneously on the router. To demonstrate this feature, lets take a network scenario as shown in fig-1. The network machines must have their IP address and default route set as indicated below:

 

Network Diagram

 

 

 

Configuration

 

Machine-1

root@machine-1# ifconfig eth0 192.168.1.10/16
root@machine-1# route add default gw 192.168.1.1

Machine-2

root@machine-2# ifconfig eth0 192.168.1.20/16
root@machine-2# route add default gw 192.168.1.1

At this moment, machine-1 and machine-2 being in different LAN segments, will not be able to reach (eg ping) each other.

Also lets take Router-B as our neighbor router with the following configuration:

Okapi(config)# interface FastEthernet 0
Okapi(config-if-eth)# ip address 192.16.1.1 255.255.0.0
Okapi(config-if-eth)# no shutdown

Okapi(config)# interface AsyncSerial 0
Okapi(config-if-serial)# encapsulation ppp
Okapi(config-if-serial)# ip address 10.5.5.5 255.255.255.0
Okapi(config-if-serial)# no shutdown

Okapi(config)# router rip
Okapi(config-router)#network AsyncSerial 0
Okapi(config-router)#network FastEthernet 0

Now lets configure Okapi router, Router-A with following steps:

Lets create a bridge with id 1 and enable STP (Spanning Tree Protocol) on it.

Okapi(config)# bridge 1
Okapi(config)# bridge 1 spanning enable

Now, lets make fastethernet 0 and fastethernet 1 the members of this newly created bridge.

Okapi(config)# interface FastEthernet 0
Okapi(config-if-eth)# bridge-group 1
Okapi(config-if-eth)# exit
Okapi(config)# interface FastEthernet 1
Okapi(config-if-eth)# bridge-group 1
Okapi(config-if-eth)# exit

Lets, assign an IP address to our bridge interface and make it a part of same logical subnet ie 192.168.0.0/16

Okapi(config)# interface Bridge_VI 1
Okapi(config-if)# ip address 192.168.1.1/16
Okapi(config-if)# no shutdown

Then configure serial interface as indicated below to establish a serial link with the neighbor router, Router-B.

Okapi(config)# interface AsyncSerial 0
Okapi(config-if-serial)# encapsulation ppp
Okapi(config-if-serial)# ip address 10.5.5.1 255.255.255.0
Okapi(config-if-serial)# no shutdown

And finally lets enable RIP on serial and bridge interfaces.

Okapi(config)# router rip
Okapi(config-router)#network AsyncSerial 0
Okapi(config-router)#network Bridge_VI 1

With this configuration on Okapi router, the two ethernet interfaces are bridged together and will act as a single logical interface which is named as Bridge_VI 1. With this bridge, the two LAN segments are connected together enabling both the segments reaching each other. Which means now machine-1 can reach (eg ping) machine-2. Also as we have enabled RIP on Okapi, it will be able to discover dynamic routes through its neighbor RIP running on Router-B. With this we have bridging and routing both happening on our Okapi router, Router-A. This can be verified by pinging various destinations from machine-1 as:

root@machine-1# ping 192.168.1.20 (pinging machine-2 on LAN-2). This verifies bridging
root@machine-1# ping 192.16.1.1 (pinging ethernet interface of Router-B). This verifies routing.