12 May 2010

Bridge, Data Link Devices

Bridges are data link layer devices that switch frames between different layer-2 segments. They perform their switching in software, and their switching decisions are based on the destination MAC address in the header of the data link layer frame.

Bridges perform three main functions:

■ They learn where devices are located by placing the MAC address of a device and the identifier of the port it is connected to in a port address table.
■ They forward traffic intelligently, drawing on information they have in their port address table.
■ They remove layer-2 loops by running the Spanning Tree Protocol (STP).

Actually, these three functions are implemented in bridges that perform transparent bridging. There are other types of
bridging, including translational bridging, source route bridging, source route transparent bridging, and source route translational bridging. However, this book only focuses on transparent bridging. The following sections introduce you to bridging; Chapter 7 goes into more depth about this subject.

Learning Function
One of the three functions of a bridge is to learn which devices are connected to which ports of the bridge. The bridge then uses this information to switch frames intelligently. When a bridge receives a frame, it reads the source MAC address in the frame and compares it to a local MAC address table, called a port address table. If the address is not already in this table, the bridge adds the address and the port identifier on which the frame was received. If the address is already in the table, the bridge resets the timer for the table entry. Entries in the table remain there as long as the bridge sees traffic from them; otherwise, the bridge ages out the old entries to allow room for newer ones.

Forwarding Function
The second function of a bridge is to intelligently forward traffic. In order to do this, the bridge uses the port address table to help it find where destinations are located. When a frame is received on a port, the bridge first performs its learning function and then performs its forwarding function. The bridge examines the destination MAC address in the frame header and looks for a corresponding entry in the port address table. If the bridge finds a matching entry, the bridge forwards the frame out of the specified port. If the port is the same port on which the frame was received (the source and destination are connected to the same port), the bridge drops the frame. If the bridge doesn’t find an entry, or if the destination MAC address is a broadcast or multicast address, the bridge floods the frame out all of the remaining ports.

Removing Loops
The third function of a bridge is to remove layer-2 loops. To see the problem that layer-2 loops can cause, consider Figure 2-5. One advantage of using two bridges to connect two segments together, as is shown in Figure 2-5, is that you have redundancy. But these loops also create problems. For instance, a bridge always floods traffic that has a destination address that is an unknown unicast, broadcast, or multicast address. And this traffic will continually circle around the loop—possibly forever.

For example, in Figure 2-5, assume that a PC generates a broadcast on Segment1. When BridgeA and BridgeB receive the broadcast, they flood it out all of their remaining ports. This means that the same broadcast will appear twice on Segment2.

Each bridge sees the other’s broadcast on Segment2 and forwards this to Segment1. And this process will go on ad infinitum. This process not only wastes bandwidth on your LAN segments but also affects the CPU cycles of all devices on these segments, since all NICs will accept the broadcast and pass it up the protocol stack for further processing.

The Spanning Tree Protocol (STP) is used to remove loops in your layer-2 network. When STP runs, one of the ports of the bridges in a loop is disabled in software. In Figure 2-5, this is the port on BridgeB that is connected to Segment2. Any user traffic is ignored if it is received on this port and is not forwarded out of this port. Going back to our broadcast example, if a PC on Segment1 generated a broadcast, both bridges, again, would receive it. BridgeA would flood the broadcast to Segment2, but BridgeB would not, since the port is in a blocked state. STP is discussed in much more depth in Chapter 7.

Problems That Bridges Solve
Bridges are used to solve collision and bandwidth problems. Each port connected to a bridge is a separate collision domain. When a frame is pulled into a port on a bridge, the bridge checks the frame’s FCS, and if the FCS if valid, the frame is forwarded out of a destination port or ports. Basically, the bridge is creating the illusion that all the physical segments that it is connected to are actually one large logical segment. All devices connected to this “logical” segment are in the same broadcast domain—this makes sense because bridges flood broadcasts. Note that if you are having problems with large amounts of broadcasts, bridges will not solve these problems.

No comments:

Post a Comment