If you have played with some Cisco switches before you might have noticed that every time you plug in a cable the led above the interface was orange and after a while became green. What is happening at this moment is that spanning tree is determining the state of the interface.
This is what happens as soon as you plug in a cable:
- Listening state: Only a root or designated port will move to the listening state. The non-designated port will stay in the blocking state.No data transmission occurs at this state for 15 seconds just to make sure the topology doesn’t change in the meantime. After the listening state we move to the learning state.
- Learning state: At this moment the interface will process Ethernet frames by looking at the source MAC address to fill the mac-address-table. Ethernet frames however are not forwarded to the destination. It takes 15 seconds to move to the next state called the forwarding state.
- Forwarding state: This is the final state of the interface and finally the interface will forward Ethernet frames so that we have data transmission!
When a port is not a designated or root port it will be in blocking mode.
This means it takes 30 seconds in total to move from listening to forwarding…that’s not really fast right? This will happen on all interfaces on the switch.
When an interface is in blocking mode and the topology changes, it’s possible that an interface that is currently in blocking mode has to move to the forwarding state. When this is the case, the blocking mode will last for 20 seconds before it moves to the listening state. This means that it takes 20 (blocking) + 15 (listening) + 15 (learning) = 50 seconds before the interface is in the forwarding state.
30 seconds is a long time right? Any modern PC with a SSD drive boots faster than that. Here’s an overview of the different port states:
State | Forward Frames | Learn MAC Addresses | Duration |
Blocking | No | No | 20 seconds |
Listening | No | No | 15 seconds |
Learning | No | Yes | 15 seconds |
Forwarding | Yes | Yes | – |
So what does this look like on an actual Cisco switch? Let me show you an example of an interface that is connected to a router. I just unplugged and plugged the cable (or do a”shut” and “no shut”) and the first time we run the show command it looks 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
You can see that the role of the port is designated and the status is listening. Keep refreshing this show command and after ~ 15 seconds it looks 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
It has moved to the learning state and after another ~ 15 seconds it looks like this:
Hi Rene,
In blocking port state,switch not able to receive and transmit any BPDUs,then How blocking port state move to listening state.
--Ravi
Mohammad,
The concept of an Alternate port was introduced with Rapid Spanning Tree. This feature takes over what the traditional (802.1 D) spanning-tree enhancement of “uplink-fast” used to do. The Alternate port serves as a “hot-standby” for a switch’s Root Port, but Alternate Port is considered to be in a Discarding state (Discarding is the RSTP term for Blocking, Listening, and Disabled for spanning-tree).
This means that an Alternate port can receive BPDUs but will not send them. As soon as a Root Port fails, the Alternate Port will immediately transitio
... Continue reading in our forumHello Rene
In your post you mentioned ports in block mode take the 20+15+15 before forwarding in some cases. Could you tell me in which case cause i was trying to simulate but i only got lis->lear->for states and not Max age time.
Thanks in advance.
Jose
Hello Jose
There are two situations which require a switch to begin STP convergence procedures. The direct and indirect link failures. Let’s take a look at both:
//cdn-forum.networklessons.com/uploads/default/original/1X/5fbad5eff789bd3c983bc63c61940dee3a6ffbe2.png
The STP is converged and Port B is in blocking state. Imagine Port A goes down. The bridge no longer detects a carrier on tha
... Continue reading in our forumThanks so much Laz.
Jose