Layer 2 Switching Loops in Network Explained

This tutorial explains what the layer 2 switching loop is and how it occurs in the network. Understand what the broadcast storm is and how the switching loop creates it.

For backup purposes, we usually create redundant links. A redundant link is an additional link that we create as the backup link of the primary link. If the primary link fails, the redundant link prevents the network from getting down due to the primary link failure.

The redundant or backup link is helpful only when the primary link fails. Until the primary link is functioning, the backup link should be disabled. If both the primary and backup links are active at the same time, they will create a switching loop.

Let’s take an example. The following image shows a simple network. In this network, a pc and a server are connected through the switches.

layer 2 switching loop

There are two links between the PC0 and the Server0.

  1. Primary / Main Link (S1, S2, S3, S6)
  2. Redundant / Backup Link (S1, S4, S5, S6)

This network will function smoothly only if one link either the primary link or the backup link is active. If both links are active, a switching loop will occur. And, due to the switching loop, this network will not work.

Before we understand the switching loop in more detail, let’s briefly understand how the switch works.

Basic concepts of the switching

To know which device is connected to which port of the switch, the switch learns and stores the MAC addresses of all connected devices in a table that is known as the CAM table.

When the switch receives a frame, it looks at the destination MAC address of the received frame in the CAM table. If it finds an entry for the destination MAC address in the CAM table, it forwards the frame from the port that is mentioned in the entry. If it does not find an entry, it forwards that frame from all of its ports except the port on which that frame arrived. This process is known as the frame forwarding.

To build the CAM table or make entries in the CAM table, the switch uses the source MAC address field of the incoming frames. There are three types of address; unicast, multicast and broadcast. From these, only the unicast address is used in the source address field.

Multicast and broadcast addresses are the destinations only addresses and these addresses are never used in the source address field of the frame. Since these addresses are not used in the source address field of any frame, a switch never learns and stores these addresses in the CAM table.

Switch takes forwarding decisions based on the CAM table entries. Since both the multicast and broadcast address can’t be added in the CAM table, frames which have these addresses in the destination field are always flooded through the switch.

Besides broadcast and multicast frames, a switch also floods the unknown unicast frame. An unknown unicast frame is a frame that’s destination address is not learned by the switch.

To know more about the learning and forwarding process of the switch, you can check the following tutorials.

How Switch learns the MAC addresses Explained

This tutorial explains the address learning process of the switch in detail with examples.

How Switches Forward Frames Explained

This tutorial explains how the switch takes forwarding decision in detail with examples.

Layer 2 Switching Loop

A switching loop occurs when more than one link exists between the source and destination devices. As explained above, a switch always floods three types of frames; unknown unicast, multicast and broadcast.

If a switch receives any frame of these types, it will forwards that frame from all of its ports except the port on which the frame arrived. If the switching loop exists, the forwarded frame will be switched in the network endlessly.

Let’s extend the above example. Suppose, PC0 sends a broadcast frame. Switch S1 receives this frame. Since this is a broadcast frame, it forwards this frame from all remaining ports except the incoming port. Other switches also follow the same concept. Since a loop exists between switches, the forwarded frame keeps switching between the switches endlessly.

The following image shows this situation.

switching loop broadcast storm

Endless Cycle One

PC0 => S1 => S2 => S3 => S6 => (Server and) S5 => S4 => S1 => (PC0 and) S2 => S3 .......

Endless Cycle Two

PC0 => S1 => S4 => S5 => S6 => (Server and) S3 => S2 => S1 => (PC0 and) S4 => S5 .......

This way, a looped frame can run in the loop for a long time (hours, days, literally forever if the switches and links never failed).

Disadvantages or side effects of the loop

When a frame loops around the network indefinitely, it is known as the broadcast storm. A broadcast storm can saturate all bandwidth of the network by creating and forwarding the multiple copies of the same frame. It also significantly decreases the performance of the end devices by forcing them to process duplicate copies of the same frame.

Besides this, a looping frame also makes the CAM table unstable. As explained above, when a switch receives a frame, it checks the source address field of the frame and associates the interface or port on which the frame arrived with the MAC address that it finds in the source address field of the frame.

If a loop exists in the network, a switch can receive the looped frame from multiple interfaces. Each time, the switch receives the looped frame from the different interface, it assumes that the device has been moved and updates the CAM table entry.

The following image shows how the switch S0 updates the entry of MAC address 1111.1111.1111.

switching loop unstable cam table

In nutshell, a layer 2 switching loop creates three major problems; broadcast storm, duplicate frames, and unstable CAM table. If a loop exists, a single looped frame is sufficient to decrease the performance of the entire network by consuming the bandwidth and CPU power of the affected devices.

To learn how to remove the layer 2 switching loop or to learn how the switches deal with the loop, check the next part of this tutorial. The next part of this tutorial is the following.

STP - Spanning Tree Protocol Explained With Examples

This tutorial explains how the switches automatically find the switching loops and remove them.

That’s all for this tutorial. If you like this tutorial, please don’t forget to share it with friends through your favorite social channel.

ComputerNetworkingNotes CCNA Study Guide Layer 2 Switching Loops in Network Explained