Bridging Loops

Recall that a Layer 2 switch mimics the function of a transparent bridge. A transparent bridge must offer segmentation between two networks, while remaining transparent to all the end devices connected to it. For the purpose of this discussion, consider a two-port Ethernet switch and its similarities to a two-port transparent bridge.

A transparent bridge (and the Ethernet switch) must operate as follows:

• The bridge has no initial knowledge of the location of any end device; therefore, the bridge must "listen" to frames coming into each of its ports to figure out on which network a device resides. The source address in an incoming frame is the clue to a device's whereabouts—the bridge assumes the source device is located behind the port that the frame arrived on. As the listening process continues, the bridge builds a table containing source MAC addresses and the bridge port numbers associated with them.

The bridge has the capability to constantly update its bridging table upon detecting the presence of a new MAC address or upon detecting a MAC address that has changed location from one bridge port to another. The bridge is then able to forward frames by looking at the destination address, looking up the address in the bridge table, and sending the frame out the port where the destination device is located.

• If a frame arrives with the broadcast address as the destination address, the bridge must forward or flood the frame out all available ports. However, the frame is not forwarded out the port that initially received the frame. In this way, broadcasts are able to reach all available networks. A bridge only segments collision domains but does not segment broadcast domains.

• If a frame arrives with a destination address that is not found in the bridge table, the bridge is unable to determine which port to forward the frame to for transmission. This type of frame is known as an unknown unicast. In this case, the bridge treats the frame as if it were a broadcast and forwards it out all remaining ports. After a reply to that frame is overheard, the bridge will learn the location of the unknown station and add it to the bridge table for future use.

• Frames that are forwarded across the bridge cannot be modified.

Bridging or switching in this fashion works well. Any frame received, whether to a known or unknown destination, will be forwarded out the appropriate port or ports so that it is very likely to be received successfully at the end device. Figure 5-2 shows a simple two-port switch functioning as a bridge, forwarding frames between two end devices. However, this network design offers no additional links or paths for redundancy, should the switch or one of its links fail.

Figure 5-2 Transparent Bridging with a Switch

PC-1

PC-2

PC-1

PC-2

Segment A

Switch A

Switch A

Segment B

PC-3

PC-4

PC-3

PC-4

To add some redundancy, a second switch can be added between the two original network segments, as shown in Figure 5-3. Now two switches offer the transparent bridging function in parallel. Consider what will happen when PC-1 sends a frame to PC-4. For now, assume that both PC-1 and PC-4 are known to the switches and are in their address tables. PC-1 sends the frame out onto network Segment A. Switch A and Switch B both receive the frame on their 1/1 ports. Because PC-4 is already known to the switches, the frame is forwarded out ports 2/1 on each switch onto Segment B. The end result is that PC-4 will receive two copies of the frame from PC-1. This is not ideal, but is not disastrous either.

Figure 5-3 Redundant Bridging with Two Switches

PC-1

PC-2

Switch A

Figure 5-3 Redundant Bridging with Two Switches

PC-1

Switch A

Bridging Mit Loop

PC-3

PC-2

Segment A

Switch B

Segment B

PC-4

Segment A

Switch B

Segment B

PC-3

PC-4

Now consider the same process of sending a frame from PC-1 to PC-4. This time, however, neither switch knows anything about PC-1 or PC-4. PC-1 sends the frame to PC-4 by placing it on Segment A. The sequence of events is as follows:

1 Both Switch A and Switch B receive the frame on their 1/1 ports. Because PC-1's MAC address has not yet been seen or recorded, each switch records PC-1's MAC address in its address table along with the receiving port number, 1/1. From this information, both switches infer that PC-1 must reside on Segment A.

2 Because PC-4's location is unknown, both switches forward the frame out all available ports, or their 2/1 ports, and onto Segment B.

3 Each switch places a new frame on its 2/1 port on Segment B. PC-4, located on Segment B, receives the two frames destined for it. However, Switch A hears the new frame forwarded by Switch B, and Switch B hears the new frame forwarded by Switch A.

4 Switch A sees that the "new" frame is from PC-1 to PC-4. From the address table, the switch had learned that PC-1 was on port 1/1 or Segment A. However, the source address of PC-1 has just been heard on port 2/1 on Segment B. By definition, the switch must relearn PC-1's location, which is now incorrectly assumed to be Segment B. (Switch B follows the same procedure, based on the "new" frame from Switch A.)

5 At this point, neither Switch A nor Switch B has learned the location of PC-4 because no frames have been received with PC-4 as the source address. Therefore, the frame must be forwarded out all available ports in an attempt to find PC-4. This frame is then sent out Switch A's 1/1 port and onto Segment A.

6 Now both switches relearn PC-1's location as Segment A, forward the "new" frames back onto Segment B, and the whole process repeats.

This process of forwarding a single frame around and around between two switches is known as a bridging loop. Neither switch is aware of the other, so each just happily forwards the same frame back and forth between its segments. Also note that because two switches are involved in the loop, the original frame has been duplicated and now gets sent around in two counter-rotating loops. What stops the frame from being forwarded in this fashion forever? Nothing. PC-4 will begin receiving frames addressed to it as fast as the switches can forward them.

Notice how the learned location of the PCs keeps changing as frames get looped. Even a unicast frame has caused a bridging loop to form, and each switch's bridge table is repeatedly corrupted with incorrect data.

What would happen if PC-1 had sent a broadcast frame instead? The bridging loops (remember that there are two of them produced by the two parallel switches) will form exactly as before. The broadcast frames will continue to circulate forever. Now, however, every end-user device located on both Segments A and B will receive and process each and every broadcast frame. This type of broadcast storm can easily saturate the network segments and bring every host on the segments to a halt.

The only way to end the bridging loop is to physically break the loop by disconnecting switch ports or by shutting a switch down. Rather than break devastating bridging loops, they should be prevented instead.

Continue reading here: Preventing Loops with Spanning Tree Protocol

Was this article helpful?

0 0

Readers' Questions

  • franco
    How do switches and bridges learn where devices are located on a network?
    7 months ago
  • Switches and bridges learn the location of devices on a network by using a protocol called Address Resolution Protocol (ARP). ARP allows devices on a network to communicate with each other by mapping their IP addresses to their physical location on the network. Each device on the network broadcasts its IP address, and the switch or bridge listens for these broadcasts and builds an ARP table of IP addresses and the associated physical locations. When a device on the network needs to communicate with another device, the switch or bridge looks up the IP address in its ARP table to identify which port the other device is located on.