STP (Spanning Tree Protocol)
Why it must exist
★★★ Because an Ethernet header has no TTL.
An IP packet in a loop has its TTL decremented to zero and gets dropped; an Ethernet frame has no such field, so a broadcast entering a loop circulates forever, duplicated on every lap -- saturating links and CPUs within seconds. That is a broadcast storm.
★★ So with redundant L2 links, something must deliberately block one of them.
Converging in three steps
★★★ (1) Elect a root: everyone compares Root ID (priority + MAC); lowest wins;
★★★ (2) Compute distance: each switch finds its cost to the root and picks one root port facing it;
★★★ (3) Block: the surplus port on the loop goes to blocking -- it forwards no data but still receives BPDUs.
★★ The topology has gone from a graph with a cycle to a tree, and a tree has no cycles.
★ Common misconceptions
★★★ "A blocked port is broken or wasted" -- it is a hot standby: when the active path fails it starts forwarding. But the cost is real: half your link bandwidth sits idle, which is exactly what MLAG and routed designs later addressed.
★★ "STP is fast" -- classic STP takes 30-50 seconds (15 seconds per forward delay). That is why RSTP exists.
★★ "Host ports must wait too" -- that is waste. Ports facing endpoints should be portfast/edge and forward immediately.