STP (Spanning Tree Protocol)

May 22, 2026
STP (Spanning Tree Protocol) is a data link layer protocol that prevents loops (cycles) in Ethernet networks.

When multiple physical connections exist between switches, the network may begin forwarding broadcast packets indefinitely. As a result, links become overloaded and the network itself becomes unstable.

STP automatically disables redundant connections and keeps only a single active data path. This way, backup links remain available but do not create loops until the primary path fails.

How Spanning Tree Protocol Works

After powering on, switches exchange BPDU service packets and negotiate which of them will be the network’s main reference point — the root bridge. A connection tree is built from it.

Each switch then selects the best path to the root bridge. If multiple paths exist, STP keeps only one active. The remaining connections are placed in standby mode: user traffic does not flow through them, but the physical link remains connected.

If the primary link goes down, STP recalculates the network topology and activates one of the backup paths. The network continues operating without loops and without manual cable switching.

Why Loops Are Dangerous

Ethernet cannot limit the lifetime of frames the way IP networks do through TTL. If a cycle appears in an L2 segment, broadcast and multicast traffic begins circulating indefinitely.

This leads to:

  • Accumulation of broadcast and multicast traffic (broadcast storm);
  • Overloading of switch CPUs;
  • MAC table overflow;
  • Loss of connectivity between devices.

Even a single accidental loop can bring down an entire enterprise network.

STP Variants

The classic STP protocol operates relatively slowly — network reconvergence can take up to 30–50 seconds.

RSTP is another version that works faster. It uses the same loop-free tree concept but transitions a backup link to active state more quickly.

MSTP is needed when a network has many VLANs. Instead of a single shared tree, it allows VLANs to be grouped and multiple independent trees to be built for them. This way, some traffic can travel over certain links and some over others, making better use of redundancy.

PVST+ is a variant commonly found in Cisco infrastructure. It builds a separate spanning tree for each VLAN. This provides more control over routes within the L2 network, but increases the amount of service logic on switches.