Spanning Tree Port States

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:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You’ve Ever Spent on Your Cisco Career!
  • Full Access to our 740 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

546 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Forum Replies

  1. When we connect a cable on Switch which runs STP on a unused port, will whole switch run STP on all ports and all ports move from Listening – Learning–Forwarding mode?

    Is the whole switch operation affected? or the port we just connected?

    Regards,
    Veerender

  2. Hi Veerender,

    It’s done per interface, not for all interfaces on the switch.

    Rene

  3. Hello, Rene
    if we suppose that we have 3 switch…we power on them…after booting,
    the port of each switch connected each other goes into listening ,because they need to do an election…(in this 15 seconds a port is learning if it will be root port,designated port , or non designated port. Once understood, if it wiil be non designated goes into blocking state otherwise it’s going into learning and then forwarding).Now the switch network will be converged…If now I focus at the port in blocking state ,it receive BPDU by a peer designatet port,every 2 sec, and sto

    ... Continue reading in our forum

  4. Hi Francesco,

    The TCN is the trigger to set the aging time, the originating switch will reduce its aging the time and other switches will as soon as they receive the TCN.

    Rene

  5. That was very good, I would also like to see the same output from a non root switch, and see at which point it changes from designated to root or non-designated. I guess the whole point of this is I can set it up myself and watch what happens.

    Chris

20 more replies! Ask a question or join the discussion by visiting our Community Forum