Read a sample: 1. Why Switched Networks Need Spanning Tree
A redundant link looks like an obvious improvement. If two switches have more than one possible path between them, a single cable failure need not isolate part of the network. The difficulty is that Ethernet switches do not automatically treat one path as the primary path and another as a quiet spare. Without a mechanism to control the active paths, redundancy can create a loop.
Spanning Tree Protocol, or STP, makes physical redundancy usable by establishing a loop-free forwarding topology. Some links can remain physically connected while selected ports do not forward ordinary traffic. If the topology changes, spanning tree can recalculate which paths should be used.
This distinction between the physical topology and the forwarding topology is the foundation of the book. The physical topology describes the switches and cables that exist. The forwarding topology describes the paths currently available for ordinary Ethernet traffic within a spanning tree instance. They need not be identical.
Before learning to predict root bridges, path costs, and port roles, it helps to see the problem those decisions solve.
Imagine three switches named Alder, Birch, and Cedar. Each switch has two interswitch connections:
- Alder port 1 connects to Birch port 1.
- Birch port 2 connects to Cedar port 1.
- Cedar port 2 connects to Alder port 2.
Together, the links form a triangle. A host named H1 connects to Alder, and a host named H2 connects to Cedar. Assume the relevant ports belong to the same Ethernet broadcast domain and that all three interswitch links can carry its traffic.
The triangle is valuable because it provides alternative routes. H1 can reach H2 through the direct Alder–Cedar link, or traffic can travel from Alder through Birch to Cedar. If one link fails, another physical route may remain.
But now suppose all three interswitch links forward Ethernet frames and no effective loop-prevention mechanism is operating. The same triangle that offers resilience also gives some frames a path back to a switch that has already handled them.
The notation in this book will state connections in plain text, such as “Alder port 1 connects to Birch port 1.” A port name belongs to the switch immediately before it: Alder port 1 is not the same interface as Birch port 1. When an example requires real-looking interface names, they will be supplied explicitly. Port labels alone do not imply a preferred path or a particular spanning tree role.
A segment is the network portion to which one or more switch ports connect. In the common point-to-point examples in this book, an interswitch link forms a segment with one switch port at each end. Keeping the two ends separate matters: spanning tree assigns roles to ports, not simply to cables.
To understand the loop, review two ordinary switching behaviors: learning and forwarding.
When a switch receives an Ethernet frame, it examines the source MAC address and associates that address with the receiving port in its MAC address table. If a later frame is destined for that learned address, the switch can normally send it toward the associated port instead of flooding it everywhere.
The destination address influences what happens next. A switch generally floods a broadcast frame out other eligible ports in the same VLAN. It also generally floods an unknown unicast frame—a unicast frame whose destination is not currently in the relevant MAC table. “Eligible” matters: the switch does not send the frame back out the port on which it arrived, and VLAN membership, spanning tree state, and other controls can limit where it forwards.
Flooding is useful. A host’s Address Resolution Protocol request, for example, may need to reach every device in its IPv4 broadcast domain. Unknown unicast flooding also allows traffic to reach a destination before the switch has learned where that destination resides.
The problem is not flooding by itself. The problem is flooding through a topology that allows copies to return.
Suppose H1 sends a broadcast frame into Alder. With all three interswitch links forwarding, a simplified sequence looks like this:
1. Alder receives the frame from H1 and learns H1’s source MAC address on the host-facing port.
2. Alder floods the frame toward both Birch and Cedar.
3. Birch receives its copy on the Alder link, learns H1’s address there, and floods the frame toward Cedar.
4. Cedar receives the copy sent directly by Alder and floods it toward Birch and H2.
5. Cedar also receives a copy from Birch and can flood that copy toward Alder and H2.
The exact order in which the copies arrive depends on timing. The important result does not: switches can receive copies from different directions and continue flooding them around the loop. Copies may also reach the hosts more than once.
Ordinary Ethernet frames do not have a general-purpose hop limit that switches decrement to stop this Layer 2 circulation. In a loop with continuing forwarding, frames can persist and multiply through the available paths. The resulting traffic can consume link capacity and switch resources, interfering with useful communication. A severe accumulation of broadcast traffic is often called a broadcast storm.
The word storm describes an effect, not a special kind of frame. Broadcasts are normal and necessary; uncontrolled repeated forwarding is the trouble. Unknown unicast traffic can also be repeatedly flooded, and some multicast traffic may be flooded depending on how the network handles it. The triangle demonstrates why a loop is…