Site is Under Maintenance
Please come back again in...
00 Days
00 Hours
00 Minutes
00 Seconds

Spanning-Tree Port States

When you plug in a cable to a Cisco switch, you may notice the LED initially lights up an amber orange and eventually turns green. This transition reflects the STP determining the interface state of the switch. Here's how it works:

1. Listening State: Only root or designated ports enter this state, while non-designated ports remain in blocking mode. In the listening state, which last for 15 seconds, the switch does not forward any data frames. This period allows the switch to ensure the network topology remains stable.

2. Learning State: After listening, the interface moves to the learning state, where it processes Ethernet frames to build its MAC address table but still does not forward frames. This state also lasts for 15 seconds.

3. Forwarding State: Finally, the interface enters the forwarding state, where it can forward Ethernet frames, allowing data transmissions.

For ports that are neither designated nor root, they remain in blocking mode, preventing data from being transmitted.

In total, it takes 30 seconds for a port to transition from listening to forwarding, which can seem lengthy in today's modern networks. If a topology change occurs, a blocking port can transition to a forwarding state but first goes through a 20-second blocking period, followed by 15 seconds in listening and another 15 seconds in learning, totaling 50 seconds before it actually starts forwarding.

Here is a quick breakdown of the different port states:
  • Blocking: No data transmissions are sent; waits to do so until topology changes have occurred.
  • Listening: No data forwarding; lasts 15 seconds
  • Learning: Builds MAC address table; lasts 15 seconds.
  • Forwarding: Forwards data; active communications are established.
This process ensures that the network remains loop-free, even though the transition times might feel slow compared to the speed of modern computing devices.


When you connect or reconnect a cable on a Cisco switch interface, you can observe the changes in state through the output of the show command. For example, after unplugging and plugging the cable back in (or using the shutdown and no shutdown commands), running the show interfaces command might initially display the interface in a "down" state.

As the interface transitions through the STP states, you might observe the following changes:

1. Initial State: The interface shows as "down" immediately after the cable is unplugged.

2. Listening State: After plugging the cable back in, the interface moves to the listening state, where it will remain for 15 seconds. The output may indicate that the interface is in a "listening" mode.

3. Learning State: After the listening period, it transitions to the learning state, where it starts building the MAC address table but still does not forward traffic.

4. Forwarding State: Finally, the interface reaches the forwarding state, allowing it to transmit and receive data. The output will show it as "up" and operational.

For example, the output might look like this:

SW1#show spanning-tree vlan

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0019.569d.5700
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0019.569d.5700
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Fa0/1               Desg LIS 19        128.4    P2p
After approximately 15 seconds, if you continue to refresh the output of the show interfaces command, you will see the interface transition from the "listening" state to the "learning" state. The updated output might look something like this:

SW1#show spanning-tree vlan 1

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0019.569d.5700
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0019.569d.5700
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Fa0/1               Desg LRN 19        128.4    P2p
After another approximately 15 seconds, the output of the show interfaces command will reflect that the interface has transitioned to the "forwarding" state. The updated output might look like this:

SW1#show spanning-tree vlan 1

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0019.569d.5700
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0019.569d.5700
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 15

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Fa0/1               Desg FWD 19        128.4    P2p
In this state, the port is now fully operational and capable of forwarding Ethernet frames. The role remains designated, indicating that this port is actively participating in the network and forwarding traffic to and from its connected devices. This transition is crucial for maintaining network stability and performance, allowing for efficient data communications across the network.

To monitor the state changes of the STP in near-real-time, you can enable debugging on the Cisco switch. This can be done using the following command:

SW1#debug spanning-tree events
After enabling this debug command, you'll see a detailed output whenever a port transitions between states. You'll notice messages indicating when a port moves to "listening," "learning," or "forwarding" states, along with timestamps for each change.

For example, the output might look something like this:

SW1#*Mar  1 00:00:10.123: STP: Port Fa0/1 in VLAN 1 is now in the Listening state
SW1#*Mar  1 00:00:25.456: STP: Port Fa0/1 in VLAN 1 is now in the Learning state
SW1#*Mar  1 00:00:40.789: STP: Port Fa0/1 in VLAN 1 is now in the Forwarding state
This near-real-time feedback is incredibly useful for troubleshooting and understanding how STP is managing port states in your network. Remember to disable debugging when you're done to avoid overwhelming the console with too much information:

SW1#undebug all
This command will turn off all debugging output.

Great! You just observed how an interface transitions through the STP port states in near-real-time by enabling debugging. Here's a recap:

By using the command:

SW1#debug spanning-tree events
You can see the STP events as they happen. For example, when you disable and re-enable the interface, the output might look like this:

SW1#
00:14:57: STP: VLAN0001 Fa0/1 -> listening
00:15:12: STP: VLAN0001 Fa0/1 -> learning
00:15:27: STP: VLAN0001 Fa0/1 -> forwarding
This step-by-step feedback is an effective way to understand how STP manages network stability. If you have any questions, or need further clarification, feel free to drop us a comment below!

Happy STP Port Stating!


Rate This Article

Thanks for reading: Spanning-Tree Port States, Sorry, my English is bad:)

Getting Info...

About the Author

I'm Aevon...Just a gal with an insane passion for all things cybersecurity. 17 years in the industry and still love what I'm doing.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.