Learn how Spanning Tree Protocol uses exchanged switch information to select a loop-free Layer 2 topology, control redundant paths, and transition interfaces safely.
What you will be able to do
- Explain how STP provides Layer 2 path redundancy while preventing undesirable loops.
- Describe how BPDUs support topology calculation and identify the information they carry.
- Distinguish the root bridge, root ports, and designated ports as STP election results.
- Explain what blocking, listening, learning, forwarding, and disabled states mean for an interface.
01
Why a switched network needs STP
Spanning Tree Protocol, or STP, manages links at Layer 2. It keeps alternate paths available while preventing undesirable loops.
Redundant links can provide more than one route through a switched network. STP controls those links so the network can retain path redundancy without allowing every path to forward.
Imagine several switches connected in a shape with more than one route between locations. STP identifies a loop-free route and stops selected paths from carrying frames.
STP is not the same as removing a cable. It places a path into a controlled state, allowing the topology to preserve an alternative link while that path is unnecessary.
02
How STP builds a tree
The spanning-tree algorithm calculates the best loop-free path through a switched Layer 2 network. Its result is a tree-shaped forwarding structure.
The calculation needs a reference switch called the root bridge. STP uses the resulting structure to decide which links should actively support the path and which are unnecessary.
For example, if two switches offer routes toward the root bridge, STP can keep one route active and place the other route in blocking mode.
The important contrast is between physical connectivity and forwarding use. A connected path can remain available without participating in normal frame forwarding.
03
BPDUs share the needed information
Bridge Protocol Data Units, or BPDUs, communicate configuration information between switches. Switches use these messages to compute the spanning-tree topology.
A BPDU carries several comparison values. These include bridge and MAC addresses, bridge priority, port priority, and path cost.
Consider two switches exchanging BPDUs across connected links. Each switch can use the received configuration information when determining the common tree.
BPDUs are information messages, not the forwarding decision itself. STP uses their contents to calculate roles and states for interfaces.
04
The roles selected by STP
STP uses exchanged information to elect a root bridge, root ports, and designated ports. These roles describe how the loop-free topology is organized.
The root bridge serves as the reference point for the tree. A root port and a designated port are selected as part of the forwarding structure around that reference.
For a simple comparison, think of the root bridge as the tree’s chosen center, while selected ports provide the useful connections leading through the tree.
Role selection differs from interface state. A port can have a role within the calculated topology, while its operational state describes whether it currently forwards.
05
Blocking is not disabled
A Layer 2 interface in blocking state does not participate in frame forwarding. STP uses this state for paths that are unnecessary for reaching the root switch.
A disabled interface is different. It participates in neither spanning tree nor frame forwarding.
Suppose a redundant route is connected but not selected for the current tree. STP can leave its interface blocking, rather than treating the interface as administratively absent.
The contrast is participation. Blocking means the interface is excluded from forwarding while STP still considers the topology; disabled means it participates in neither activity.
06
The startup transition
During startup, each port passes through blocking, listening, and learning states. These stages support a controlled change toward forwarding.
Listening is the first transitional state after blocking when an interface must participate in forwarding. The interface is moving toward participation rather than immediately forwarding frames.
When an interface enters forwarding, it first enters listening while awaiting protocol information before continuing through transitional states.
A port changing from nonparticipation to forwarding can temporarily create data loops. The transitional sequence provides time for protocol information to guide the change.
07
Port priority and path cost
Port priority and port path cost help determine which port forwards when links form a loop. The competing port can forward while the others block.
Port path cost is derived from interface media speed and represents that speed in the STP decision. It gives STP a value for comparing possible paths.
For example, when two looped ports compete, STP evaluates their configured priority and their path-cost information before selecting forwarding behavior.
Priority and cost are related but distinct. Priority is a port-selection value, while path cost represents the speed of the interface media.
08
The tie-breaking rule
If port priorities tie, STP forwards the interface with the lowest interface number and blocks the others.
This rule provides a definite result when priority does not distinguish the competing ports. The interface number becomes the deciding comparison.
For instance, two looped interfaces with equal priority do not remain equally active. The one with the lower interface number forwards, and the others block.
The tie-breaker does not replace path cost in every decision. It applies specifically when the port priorities tie.
09
Lesson recap: ready for Practice and Prove
STP manages Layer 2 links by preserving path redundancy while preventing undesirable loops. It calculates a best loop-free path through the switched network.
10
Recap: topology information
BPDUs carry configuration information, including bridge and MAC addresses, priorities, and path cost. Switches use that information to compute the topology and elect key roles.
Spanning Tree Protocol, or STP, manages links at Layer 2. It keeps alternate paths available while preventing undesirable loops.
The spanning-tree algorithm calculates the best loop-free path through a switched Layer 2 network. Its result is a tree-shaped forwarding structure.
A Layer 2 interface in blocking state does not participate in frame forwarding. STP uses this state for paths that are unnecessary for reaching the root switch.