Spanning Tree Protocol (STP): Breaking the Loop
Spanning Tree Protocol (STP) dynamically blocks redundant links in a switched network to prevent broadcast storms and Layer 2 loops.
The Threat of Layer 2 Loops
Redundancy is critical for network availability. However, simply adding redundant links between switches creates a **Layer 2 loop**. Because Ethernet frames do not have a Time-To-Live (TTL) field, broadcast frames loop endlessly, causing a **broadcast storm**. This rapidly consumes all bandwidth and CPU resources, causing the network to crash.
How STP Works
**Spanning Tree Protocol (IEEE 802.1D)** prevents these loops by creating a loop-free logical topology. Switches exchange Bridge Protocol Data Units (BPDUs) to elect a single **Root Bridge**. All other switches calculate the shortest path to the Root Bridge. Ports on these shortest paths are placed in a Forwarding state, while redundant ports are placed in a Blocking state.
The STP Election Process
The Root Bridge election is based on the lowest **Bridge ID (BID)**, which consists of a priority value and the switch's MAC address. By default, the priority is 32768. If priorities tie, the lowest MAC address wins. Administrators should always manually configure the core switch as the Root Bridge by lowering its priority using `spanning-tree vlan [id] root primary`.
❓ Frequently Asked Questions
What happens if a forwarding link fails in STP?
STP recalculates the topology and transitions a previously blocked port through listening and learning states into the forwarding state.
What is a BPDU?
A Bridge Protocol Data Unit is a multicast frame used by switches to share STP information and maintain the loop-free topology.
How long does classic STP take to converge?
Classic 802.1D STP takes up to 50 seconds to transition a port from blocking to forwarding.