Course contents

Chapter 6: Spanning Tree ProtocolLesson 7 of 25

Port states and timers

A switch has selected a root port, so why are the PCs still waiting for traffic to pass? Let's separate the port's job from its state and follow the classic STP timers.

Intermediate · 7 min read

A selected path is not yet a forwarding path

A port role describes the port's job in the spanning tree. A root port is a switch's selected path towards the root bridge; a designated port advertises the best root information on its segment. A state controls whether the port currently forwards user frames or learns source MAC addresses.

For this lesson SW1 is root, and SW2 and SW3 form the same triangle as before. PC A on SW2 is 192.168.10.10/24 and PC B on SW3 is 192.168.10.20/24, both in VLAN 10. On SW3, Gi1/0/1 connects to SW1, Gi1/0/2 connects to SW2 and Gi1/0/10 connects to PC B. Assume gigabit links using short-method cost 4 and SW2's bridge ID lower than SW3's.

Why ports can't forward straight away

Reason 1: building the tree takes time. Choosing a root, comparing costs and choosing roles all happen through BPDUs. That exchange does not complete everywhere at exactly the same instant. If ports forwarded before a safe topology was established, a broadcast could loop before STP had chosen which ports to block:

Diagram
A temporary loop if ports forwarded during convergence
A temporary loop if ports forwarded during convergence
SW1just bootedSW2just bootedSW3just bootedPC APC B

Device key: SW1, SW2, SW3 (switch) · PC A, PC B (computer)

Lines show the example’s network connections. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.

  1. 1. The switches are still agreeing on a root… No port is blocked yet.
  2. 2. …when PC A sends a broadcast. If every port were already forwarding…
  3. 3. …it would loop. Even a few seconds of looping can overload the switches and upset the network. Port states stop this from happening.
This is a counterexample: user frames would loop if all three sides forwarded before safe roles and states were established. It is not an instruction to disable spanning tree.

Reason 2: old information can remain in use. A BPDU (Bridge Protocol Data Unit) carries the control information used to select the tree. After a failure, another switch can still hold an older record. Classic STP uses timer-based safeguards to allow information to propagate and age before opening a new path. It does not obtain a confirmation from every switch that every database is current. RSTP later introduced faster agreement mechanisms for suitable links.

Blocking, listening, learning, forwarding

StateTypeForwards framesLearns MACsBPDUsDuration
BlockingStableNoNoReceives control informationWhile redundant
ListeningTransitionalNoNoSends & receives15 s
LearningTransitionalNoYesSends & receives15 s
ForwardingStableYesYesSends & receivesOngoing
DisabledNot participatingNoNoNoneUntil enabled and the link is operational
  • Disabled: administratively shut down or otherwise not operational for participation. It has no active user forwarding path.
  • Blocking: does not forward user frames or learn their source MAC addresses. It can receive BPDUs and remain blocked indefinitely while that path is redundant.
  • Listening: a root or designated port is moving towards forwarding. It processes control information but still does not learn source MAC addresses from user frames.
  • Learning: learns source MAC addresses from arriving user frames but does not forward those frames. This can reduce unknown-unicast flooding when forwarding starts; it does not guarantee that every destination is already known.
  • Forwarding: can forward eligible user frames and learn their source MAC addresses. Control processing continues. BPDU transmission details depend on the role and protocol, not just this state.

A transition to non-forwarding does not need the two forward-delay waits. Opening a new classic-STP path is the operation that needs the listening and learning checks.

Watch a classic-STP port prepare to forward

These illustrative Cisco PVST+ snapshots start after SW3 has selected its roles, not at an exact time measured from pressing a power button. Default forward delay is 15 seconds, VLAN 10 uses classic STP, and these example ports do not use PortFast. Boot time and BPDU arrival can add delay before this sequence starts.

Illustrative PVST+ excerpt · listening stage after role selection
SW3#show spanning-tree vlan 10
VLAN0010
  Spanning tree enabled protocol ieee
  Root ID    Priority    24586
             Address     0200.0000.0001
             Cost        4
             Port        1 (GigabitEthernet1/0/1)
...
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi1/0/1             Root LIS 4         128.1    P2p
Gi1/0/2             Altn BLK 4         128.2    P2p
Gi1/0/10            Desg LIS 4         128.10   P2p
The alternate port goes straight to BLK (blocking). The Root and Desg ports go straight to LIS (listening). That shows why a role alone does not prove forwarding. These listening ports do not learn user source MAC addresses, although unrelated ports and pre-existing entries can still appear in the switch's MAC table.
Illustrative PVST+ excerpt · about one forward delay after listening starts
SW3#show spanning-tree vlan 10
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi1/0/1             Root LRN 4         128.1    P2p
Gi1/0/2             Altn BLK 4         128.2    P2p
Gi1/0/10            Desg LRN 4         128.10   P2p
Illustrative user-frame learning · assumes both PCs send frames
SW3#show mac address-table dynamic vlan 10
          Mac Address Table
-------------------------------------------
Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
  10    0200.0000.000a    DYNAMIC     Gi1/0/1
  10    0200.0000.000b    DYNAMIC     Gi1/0/10
After one forward delay (15 seconds), the ports are LRN (learning). The MAC table is filling up, but the affected ports still are not forwarding user traffic. These entries come from the source MACs of user frames, not from treating a BPDU as ordinary learned host traffic.
Illustrative PVST+ excerpt · about two forward delays after listening starts
SW3#show spanning-tree vlan 10
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi1/0/1             Root FWD 4         128.1    P2p
Gi1/0/2             Altn BLK 4         128.2    P2p
Gi1/0/10            Desg FWD 4         128.10   P2p
After the second forward delay: FWD (forwarding). In total, 15 s listening + 15 s learning = 30 seconds for this classic, non-edge transition once listening begins. A correctly configured PortFast edge port follows a different path; the timing is not a universal delay for all PC connections.

Hello, max age and forward delay

Diagram
Hello, max age and forward delay
Hello, max age and forward delay
TimerDefaultWhat it controls
Hello2 sHow often the root sends BPDUs. Other switches pass them on out of their designated ports.
Max age20 sMaximum permitted age of stored configuration information; received message age has already used part of this allowance.
Forward delay15 sTime spent in listening, and again in learning
Read each row across: the left box names the item, the others describe it.

A missed BPDU does not necessarily invalidate stored information immediately. If its age reaches max age without a valid refresh, the switch throws away that information and works everything out again: who the root is, which port is its root port, and which ports are designated.

In the converged classic tree, the elected root bridge's timer values are advertised and adopted by the other participating switches. Each switch also has locally configured values that matter if it later becomes root. The defaults were designed around bounded network-diameter assumptions, not an unlimited chain of switches. Timer tuning needs the complete design and parameter relationships; do not shorten a single value to make a lab look faster.

RSTP improves the transition mechanisms rather than simply setting every timer to zero. Its rapid operation depends on neighbour compatibility, point-to-point or shared link behaviour and edge status. A migration needs planning; changing the spanning-tree mode can affect the whole switch.

Thirty seconds or fifty: how long recovery takes

The table is a classic-STP calculation using default timers, a usable replacement path and no acceleration features. It illustrates transition work, not a recovery-time guarantee.

Diagram
Thirty seconds or fifty: how long recovery takes
Thirty seconds or fifty: how long recovery takes
SituationWaits forTotal
Selected non-edge port begins opening, or direct link loss selects a replacementListening 15 + learning 15, after selectionAbout 30 s for those stages
Stored information must age out before the replacement is selectedRemaining age allowance, then listening 15 + learning 15Commonly illustrated as up to about 50 s
Read each row across: the left box names the item, the others describe it.

The next lesson shows an indirect failure step by step. PortFast, covered in its own lesson, removes the wait for end devices. RSTP (the Rapid Spanning Tree lessons) can use rapid agreement and alternate-port transitions instead of the full classic wait. Legacy neighbours and other conditions can still require slower handling.

Short lab: observe states without tuning timers

Use an isolated Cisco IOS/IOS XE lab that is already running classic PVST+ for VLAN 10, with SW3 Gi1/0/1 towards SW1 and Gi1/0/2 towards SW2. Keep the original STP and guard settings. Verify that the inter-switch uplink is not an edge/PortFast port. If the image runs RSTP, observe its actual states instead of changing a live switch merely to reproduce this table.

show spanning-tree summary show spanning-tree vlan 10 configure terminal interface GigabitEthernet1/0/1 shutdown end show spanning-tree vlan 10

SW3 only, isolated lab. Record the original roles and timers first. A verified direct root-port shutdown lets you observe the replacement path without disabling loop protection.

Watch Gi1/0/2 as the protocol selects it towards SW2 and permits it to forward. Note when listening, learning and forwarding appear, and compare with the reported timers. Test PC A to PC B after convergence. Restore Gi1/0/1 with no shutdown, verify the original roles return, and leave the original timers unchanged. Packet loss includes more than the state timers, so record observations rather than declaring an exact recovery time.

Test yourself on states and timers

Predict · scenario 1

In which state does a port learn MAC addresses but still not forward frames?

Predict · scenario 2

Classic STP selects a redundant port to remain non-forwarding. Must it complete listening and learning before it can be blocked?

Predict · scenario 3

In a simplified classic STP case, old information has almost the full 20-second max-age allowance left. A replacement then spends 15 seconds listening and 15 learning. What total does this illustrate?

Sources: Cisco STP timers and message age; Cisco RSTP state and transition differences. Commands and snapshots are illustrative, not captures from a tested switch image.