Back to all questions

What are the Different States of STP Ports?

Rostyslav Pidgornyi
Spanning Tree Protocol
February 19, 2025

STP (Spanning Tree Protocol) ports transition through different states to prevent network loops while maintaining redundancy. The STP port states are:

  1. Disabled – Port is administratively shut down.
  2. Blocking – Port is on but not forwarding traffic to prevent loops.
  3. Listening – Preparing to forward by removing old MAC addresses.
  4. Learning – Learning MAC addresses but not forwarding traffic yet.
  5. Forwarding – Fully active, forwarding traffic.

These Spanning Tree states ensure only one active path exists between switches while keeping backup paths ready in case of failure.

Let’s go through each of these Spanning Tree states in detail.

1. STP Blocking State

  • What it does: Prevents network loops by keeping non-essential links inactive.
  • Is it forwarding traffic? ❌ No
  • Is it learning MAC addresses? ❌ No

When an STP-enabled switch first powers up, all ports start in the Blocking state. This is a protective mechanism to ensure that no loops are formed before STP determines the best path.

Ports in Blocking mode are still active in the sense that they listen for BPDU (Bridge Protocol Data Unit) messages, but they do not send any user data. The switch examines these BPDU messages to identify potential loops and elects a Root Bridge—the central switch responsible for determining the best forwarding paths.

If STP decides that a particular port is not needed for forwarding (because another path is more efficient), that port remains in Blocking indefinitely. However, if it is needed later (e.g., due to a failure elsewhere), it can transition to Listening and eventually Forwarding.

Example Scenario:

Imagine you have two switches (Switch A and Switch B) connected by two separate cables. If both connections were active at the same time, data would continuously cycle between the switches, causing a loop.

To prevent this, STP blocks one of the ports. That port will not forward traffic unless the active link fails, at which point STP will unblock the previously blocked port and allow traffic to flow through it.

Key takeaway: The Blocking state prevents loops but still monitors BPDU messages for network changes.

2. STP Listening State

  • What it does: Prepares the port for activation by removing old MAC addresses.
  • Is it forwarding traffic? ❌ No
  • Is it learning MAC addresses? ❌ No

A port enters the Listening state when it is transitioning from Blocking to Forwarding. It does not send or receive user data, but it actively listens to BPDU messages to determine whether it should move forward in the STP process.

Since ports that were previously blocked might have outdated information, the Listening state clears out old MAC addresses that may no longer be valid. The goal is to reset the port before allowing it to forward traffic.

Example Scenario:

Let’s say one of your primary links between two switches fails, and STP selects a previously blocked port to take over. That port does not immediately start forwarding traffic—instead, it enters Listening mode first.

In this state, it ensures that any outdated or incorrect MAC address mappings are removed before allowing traffic to pass through.

Key takeaway: The Listening state acts as a transitional phase to ensure a clean forwarding path.

3. STP Learning State

  • What it does: Learns MAC addresses to prepare for forwarding.
  • Is it forwarding traffic? ❌ No
  • Is it learning MAC addresses? ✅ Yes

Before a port can start forwarding traffic, it must learn which devices are connected to the network.

In the Learning state, the port begins building its MAC address table by analyzing incoming frames (without actually forwarding them). This helps the switch efficiently direct traffic when the port transitions to Forwarding.

The main difference between Listening and Learning is that Listening removes old MAC addresses, while Learning builds a new MAC address table.

Example Scenario:

A switch with multiple VLANs (Virtual LANs) may need to quickly learn the MAC addresses of devices in each VLAN before forwarding traffic. This avoids flooding the network with unnecessary broadcasts.

If a previously blocked port is activated, it enters Learning mode to gather MAC addresses before becoming fully operational.

Key takeaway: The Learning state prevents network disruptions by ensuring the switch knows where to send data before it starts forwarding.

4. STP Forwarding State

  • What it does: The port is fully operational, forwarding traffic.
  • Is it forwarding traffic? ✅ Yes
  • Is it learning MAC addresses? ✅ Yes

Once a port reaches the Forwarding state, it is fully active—it can send and receive user data while still participating in STP topology calculations by exchanging BPDU messages.

A Forwarding port will keep an eye on network changes and will transition back to Blocking if STP detects a new loop in the network.

Example Scenario:

Imagine a Root Bridge (the main switch) in your network. The ports that connect directly to other switches are typically in Forwarding mode, allowing traffic to flow freely. However, if another switch joins the network, STP may recalculate the topology, and some ports may return to Blocking to prevent new loops.

Key takeaway: The Forwarding state is the final active state, but the port continues to monitor network changes to adapt if needed.

5. STP Disabled State

  • What it does: The port is manually shut down by an administrator.
  • Is it forwarding traffic? ❌ No
  • Is it learning MAC addresses? ❌ No

A port enters Disabled mode when it is either:

  1. Manually turned off by a network administrator
  2. Physically disconnected
  3. Experiencing a failure (e.g., cable unplugged or hardware issue)

Unlike Blocking mode, which is controlled by STP, Disabled mode is completely independent of the STP process.

A Disabled port will not listen for BPDU messages, will not transition into any other STP state, and will remain inactive until re-enabled manually.

Example Scenario:

Let’s say you have a port on a switch that connects to a workstation that’s no longer in use. Instead of leaving the port active, an admin may disable it for security reasons to prevent unauthorized access.

Key takeaway: Disabled mode is not part of STP calculations—it’s an admin-controlled state.

How STP Port States Work Together

The STP port state lifecycle ensures a network remains loop-free while maintaining redundancy. Here’s how it works:

1. Blocking → Initial state to prevent loops.

  • Ports start here by default.
  • Listens for BPDU messages to determine if forwarding is safe.
  • Doesn’t learn MAC addresses or forward data.
  • If needed, transitions to Listening.

2. Listening → Prepares for activation, removes old MACs.

  • Cleans up stale MAC addresses.
  • Continues monitoring BPDU messages.
  • No data forwarding yet.
  • If stable, moves to Learning.

3. Learning → Learns MAC addresses, but no traffic yet.

  • Builds the MAC address table.
  • Ensures traffic will be forwarded efficiently.
  • No forwarding yet, just preparing.
  • If topology remains stable, transitions to Forwarding.

4. Forwarding → Fully operational

  • The port is now fully functional and actively forwarding traffic.
  • Keeps learning MAC addresses dynamically.
  • Continues listening to BPDU messages to detect topology changes.

5. Disabled (If the port is manually shut down or loses power)

  • Unlike Blocking, which is an STP decision, Disabled is an admin decision.
  • The port does not participate in STP or process BPDU messages.
  • Can only become active again through manual intervention.