Spanning Tree Protocol

1. Introduction to Spanning Tree Protocol

The Spanning Tree Protocol is a well known protocol that have a huge task to achieve. This task is to make sure we never have a network loop in our network.

Why would we have a network loop ?

In a typical network topology you can have multiple path leading to a destination and having multiple path can be dangerous. Let’s me show you with the example below:

How Loops Happen

Imagine a simple network with three interconnected switches (SW1, SW2, SW3) and two devices (PC1 and PC2).

Each switch is linked to the others for redundancy. In this setup:

  1. PC1 sends a broadcast request (ARP request to communicate with PC2).
PC1 sends ARP broadcast request through switch SW1 to locate PC2 on the network
Figure 1 – PC1 Sends an ARP Request (Broadcast)

2. The switches forward the broadcast to all ports excluding the one it arrived.

SW1 flood the ARP broadcast to all of his ports except the one that received the arp broadcast
Figure 2 – SW1 Floods the ARP Broadcast

3. SW2 and SW3 receive the broadcast and again send this broadcast to all of theirs ports, creating a network loop.

Why Loops Appear Without STP
Figure 3 – SW2 and SW3 Flood the Broadcast Again (Loop Begins)

2. Why Loops Are a Problem

Loops can cause severe network disruptions:

Network loop problem caused by ARP broadcasts in a topology without Spanning Tree Protocol
Figure 4 – Why Loops Are a Problem
  • Broadcast storms: Endless circulation of broadcast frames saturates the network, leaving no bandwidth for legitimate traffic.
  • MAC table instability: Switches struggle to learn the correct location of devices, leading to unpredictable behavior.
  • Network crashes: Excessive traffic overwhelms the network, potentially causing devices to disconnect.

3. How STP Stops Loops

The Spanning Tree Protocol (STP) solves the problem of loops by blocking redundant paths. In any network segment where multiple paths exist, STP determines the best path and temporarily disables the others.

STP prevents network loop by blocking redundant port and stopping ARP broadcast propagation
Figure 5 – How STP Prevents the Loop

By doing so:

  • Loops are eliminated: Only one active path is used for communication.
  • Backup paths remain available: If the active path fails, a blocked path is automatically activated to maintain connectivity.
  • Network performance is stabilized: STP ensures efficient traffic flow without disruptions.
STP topology with SW1 as root bridge and a blocked port between SW2 and SW3 to prevent loops
Figure 6 – STP Maintains a Loop-Free Backup Path

Now that we understand the importance of STP in preventing network loops, let’s dive deeper into the foundational concepts in How Spanning Tree Protocol Works.