STP Timers & STP States

1. Introduction

In the previous course, we assigned port roles such as Root Port, Designated Port, and Alternate (Blocked) Port to ensure we have a loop-free network. However, Spanning Tree Protocol (STP) does more than just assign roles ! It also governs how the network converges when one switch crash in the topology.

Convergence refers to the process of ensuring that all switches agree on a new Spanning Tree Topology and can forward traffic effectively after a change, such as a link failure or the addition of a new device.

Spanning Tree Protocol diagram showing port roles and network convergence after a switch failure.

This process relies on STP Timers and STP Port States, which together dictate how long it takes for the network to adapt to changes while preventing loops during the transition.

Convergence ensures the following:

  • Stable Topology: All switches agree on the Root Bridge and the port roles for each segment.
  • Efficient Traffic Flow: Traffic resumes efficiently after a topology change, avoiding loops.
  • Minimal Disruption: The network adapts without causing packet loss or instability.

2. Understanding STP Timers

Important: Before diving into the Port States, ensure you understand the role of STP Timers, as they govern the duration and transition between states.

Hello Timer

  • Purpose: Determines how often the Root Bridge sends BPDUs (Bridge Protocol Data Units) to communicate topology information.
  • Default Value: 2 seconds.
  • Significance: Once the Root Bridge is elected, it is the only switch that generates and sends BPDUs to the entire Spanning Tree topology. These BPDUs serve to announce the Root Bridge’s presence and maintain the topology.
Spanning Tree Protocol diagram showing BPDU Hello Timer intervals sent by the Root Bridge every 2 seconds.

The non-root switches in the network do not generate their own BPDUs. Instead, they forward the BPDUs received from the Root Bridge to their neighbors, including their own sender Bridge ID, ensuring the topology remains synchronized.

Forward Delay Timer

This timer is important to understand to fully graps the concept of STP port states, you will have to recheck here,

  • Purpose: Controls the time a port spends in the Listening and Learning states before transitioning to Forwarding.
  • Default Value: 15 seconds per state .

Max Age Timer

  • Purpose: Defines how long a switch retains BPDU information from the Root Bridge before considering it invalid.
  • Default Value: 20 seconds.
  • Significance: Ensures switches detect and react to topology changes (For example when Root Bridge crash)

3. Understanding STP Port States

To explain the port states, let’s use an example scenario where the Root Bridge fails, triggering a topology change.

Practical Example: Topology Change Process

Initial State: Stable Topology

The Root Bridge sends BPDUs every 2 seconds to maintain the topology.

Non-root switches forward these BPDUs while retaining their roles (Root Port, Designated Port, and Blocked Port).

Spanning Tree Protocol diagram illustrating stable topology with BPDU transmissions every 2 seconds from the Root Bridge.

Step 1: Root Bridge Failure

The Root Bridge stops sending BPDUs.

Spanning Tree Protocol diagram showing Root Bridge failure and impact on BPDU transmission.

Non-root switches wait for the Max Age Timer (20 seconds) to expire. During this time, ports remain in their current states (Forwarding or Blocking).

Spanning Tree Protocol diagram showing Max Age Timer waiting period after Root Bridge failure.

Step 2: Transition for Root and Designated Ports

  • After the Max Age Timer expires, ports assigned as Root Ports and Designated Ports transition to the Listening State to reevaluate the topology.
Spanning Tree Protocol diagram illustrating port state transitions from Blocking to Forwarding.

Ports in the Blocking State remain blocked unless a topology change requires them to become active.

Step 3: Listening State

In this state:

  • Ports exchange BPDUs to elect a new Root Bridge and reevaluate port roles.
  • No data traffic is forwarded to prevent loops.
Spanning Tree Protocol diagram highlighting the Listening State during port role re-evaluation.
  • Duration: 15 seconds (Forward Delay Timer).

Step 4: Learning State

  • Ports process incoming Ethernet frames to update the MAC address table.
  • No traffic is forwarded yet.
Spanning Tree Protocol diagram showing the Learning State where MAC addresses are updated before forwarding.
  • Duration: 15 seconds (Forward Delay Timer).

Step 5: Forwarding State

  • Root Ports and Designated Ports transition to the Forwarding State.
Spanning Tree Protocol diagram showing ports transitioning to the Forwarding State for traffic forwarding.
  • Ports actively forward traffic and participate in BPDU exchanges.

Step 6: Blocking State (if applicable)

  • Ports that are not selected as Root or Designated Ports remain in the Blocking State to prevent loops.
  • These ports continue to listen for BPDUs and may transition to active states if the topology changes again.

4. Summary of Port States

  • Blocking: Prevents loops by dropping traffic while listening for BPDUs. No data traffic is forwarded, and the MAC address table is not updated.
  • Listening: Exchanges BPDUs to determine the Root Bridge and port roles. No data traffic is forwarded, and the MAC address table is not updated.
  • Learning: Learns MAC addresses to populate the table. No traffic is forwarded yet, but BPDUs are exchanged.
  • Forwarding: Actively forwards traffic and exchanges BPDUs. The MAC address table is updated in real-time.
  • Disabled: The port is administratively down or not part of STP. It does not send, receive, or process any frames or BPDUs.
StateBPDU HandlingMAC Address Table UpdatesForwards Traffic?
BlockingListens for BPDUs
ListeningExchanges BPDUs
LearningExchanges BPDUs
ForwardingExchanges BPDUs
DisabledDoes not process BPDUs

5. Times to Convergence

Why Does STP Take 50 Seconds to Converge?

The convergence time of 50 seconds in STP is determined by the following timers:

  • Max Age Timer (20 seconds): A switch waits for this duration after losing BPDU information to ensure the Root Bridge is no longer active.
  • Forward Delay Timer (30 seconds): Composed of two 15-second intervals, during which ports transition through the Listening and Learning states to prevent forwarding loops.
Spanning Tree Protocol diagram showing timers for network convergence, including Max Age Timer and Forward Delay.

While these timers ensure a stable topology, the lengthy process introduces significant delays in adapting to changes. For modern networks with real-time applications like VoIP, video streaming, or online gaming, such delays can result in service disruptions and performance degradation.

The Problem with Slow Convergence

In today’s networks, downtime and packet loss caused by STP’s slow convergence can lead to:

  • Increased Latency: Critical traffic is delayed, impacting time-sensitive applications.
  • Network Instability: Prolonged transition periods increase the risk of temporary loops and packet flooding.
  • User Dissatisfaction: End users experience service interruptions, leading to frustration and potential loss of trust.

How RSTP Solves the Issue

Rapid Spanning Tree Protocol (RSTP) addresses the limitations of STP by significantly reducing convergence times to just a few seconds. RSTP achieves this through:

Next Steps: In the following course, we’ll dive into RSTP, exploring its mechanisms and benefits for modern networks.