Why spanning tree?

Redundancy makes loops

Three switches wired in a triangle survive any single cable failure. But the triangle is a loop, and Ethernet frames have no TTL: nothing ever removes them.

ProblemWhat happens
Broadcast stormA broadcast is flooded out every port, comes back around the loop, and is flooded again, forever, multiplying until the links are full
MAC table instabilityThe same source MAC arrives on different ports as copies circle, so the switch keeps moving the entry
Duplicate framesHosts receive the same frame several times

The fix

Spanning Tree Protocol (STP, IEEE 802.1D) lets switches exchange BPDUs (Bridge Protocol Data Units), agree on a loop-free tree, and block just enough ports to break every loop. If a working link fails, a blocked port takes over.

In NetLab

▶ SW1
SW1>enable
SW1#show spanning-tree | begin Interface
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1               Altn BLK 4         128.25   P2p 
Gi0/2               Root FWD 4         128.26   P2p 
▶ SW2
SW2>enable
SW2#show spanning-tree | begin Interface
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Fa0/1               Desg FWD 19        128.1    P2p 
Gi0/1               Desg FWD 4         128.25   P2p 
Gi0/2               Root FWD 4         128.26   P2p 
▶ SW3
SW3>enable
SW3#show spanning-tree | begin Interface
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Fa0/1               Desg FWD 19        128.1    P2p 
Gi0/1               Desg FWD 4         128.25   P2p 
Gi0/2               Desg FWD 4         128.26   P2p 

One port in the whole triangle is blocked: SW1's Gi0/1 (Altn BLK). The tree is SW3–SW1 and SW3–SW2, and the SW1–SW2 link is the spare.

Remember: Spanning tree keeps redundant links but uses only a loop-free subset of them. It is on by default on every Cisco switch: don't turn it off.

HOME LABS COMMUNITY DASHBOARD