Logical STP TopMost of this demonstration will be on the above Topology, except for the the output for changing Port cost, for that I’ll just be using 2 Trunk links between SW1 and SW2.

 

STP Link Speed to Path Cost, and how to change Path cost on an interface

 

The link speed to STP cost default values are in order from fastest to slowest here:

10gbps = 2
1gbps = 4
100mbps = 19
10mbps = 100

The “Path cost” is the local interfaces supported speed, whereas the Root Cost is the entire cost of all paths back to the Root Bridge as explained below.

 

How to identify a Root Switch (or non-Root Switch) in several different ways

 

From the Root Bridge itself

The Root Bridge makes itself easy to identify, here is the output from “sh span” on my Root Bridge SW4 and the verification output it shows:

SW4#sh span

VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0017.5aa8.a600
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 0017.5aa8.a600
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300

Interface Role Sts Cost Prio.Nbr Type
—————- —- — ——— ——– ——————————–
Fa0/3 Desg FWD 19 128.5 P2p
Fa0/4 Desg FWD 19 128.6 P2p

SW4#

Highlighted in red is the Priority and MAC Address which makes up the BID in the format of 32769:0017.5aa8.a600 for SW4, highlighted in blue is the root bridge information (which on the Root bridge itself is simply shown with “This bridge is the root”), and highlighted in green are the timers all at their default values.

Highlighted in hot pink because I am running out of colors, is the interface information on the local switch, and on the Root Bridge itself the interfaces will all be in the role “Desg” and state of “FWD” whereas Non-Root switches will have a Root Port.

To recap, from top to bottom of the STP output there is:

  • Root Bridge info (Root Path highlighted in red in this block of output)
  • Local Bridge info (local BID info)
  • The timers set by the Root Bridge in both categories
  • Local interfaces role, state, Path cost, interface # and Priority ID, and Type

In the last portion I emphasize “Path” cost, because that is the cost for that specific interface on the local switch, and not the “Root Cost” or total STP Cost to get to the Root Bridge – This will be demonstrated on SW2 below!

Verifying the Root from another switch

SW3#sh span

VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0017.5aa8.a600
Cost 19
Port 5 (FastEthernet1/0/3)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

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

Interface Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
Fa1/0/2 Desg FWD 19 128.4 P2p
Fa1/0/3 Root FWD 19 128.5 P2p

SW3#

It can be seen that in the Root ID (Root Bridge) output it shows both the Cost to the Root Bridge, and the interface on the local switch that is the Root Port.

SW2’s perspective of the STP network

SW2#sh span

VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0017.5aa8.a600
Cost 38  <—- Note Root Cost 38 ******
Port 3 (FastEthernet1/0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

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

Interface Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
Fa1/0/1 Root FWD 19 128.3 P2p <—- Note Local Cost 19 *******
Fa1/0/2 Altn BLK 19 128.4 P2p

Because SW2 is the only switch not connected directly to the Root Bridge, it will have a Root Path Cost of 38 either interface it takes, whereas the STP interface at the bottom of the output reflects the local interfaces Cost to its next hop switch which is 19.

This is the difference between Root Cost and Local Cost, Root Cost is the entire Cost to reach the Root, whereas the Local cost is the link between the local and next hop switch.

 

Now to pull the plug on SW2 Fa1/0/1 and “debug span events”

 

To demonstrate some STP debugging and confirm the default timers of learning / listening states, below is the output from pulling the FWD interface cable from SW2 forcing Fa1/0/3 out of BLK state and its transition:

SW2#debug span events
Spanning Tree event debugging is on
SW2#
*Mar 1 00:31:50.429: STP: VLAN0001 new root port Fa1/0/2, cost 38
*Mar 1 00:31:50.429: STP: VLAN0001 Fa1/0/2 -> listening
*Mar 1 00:31:50.429: STP[1]: Generating TC trap for port FastEthernet1/0/1
*Mar 1 00:31:50.438: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
*Mar 1 00:31:51.428: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0/1, changed state to down
*Mar 1 00:31:52.434: %LINK-3-UPDOWN: Interface FastEthernet1/0/1, changed state to down
*Mar 1 00:31:52.434: STP: VLAN0001 sent Topology Change Notice on Fa1/0/2
*Mar 1 00:32:05.437: STP: VLAN0001 Fa1/0/2 -> learning
*Mar 1 00:32:20.444: STP[1]: Generating TC trap for port FastEthernet1/0/2
*Mar 1 00:32:20.444: STP: VLAN0001 Fa1/0/2 -> forwarding
*Mar 1 00:32:20.452: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up

So once the cable unplugs STP performs the following:

  • Puts Blocking interface immediately into Listening, starts something called a TC trap
  • 15 seconds later transitions into Learning, announces Topology change to network
  • 15 seconds later transitions into role Root Port with a state of Forwarding

 

Now to plug interface Fa1/0/1 back into SW2 to demonstrate this process in reverse

 

So in reverse, there is an interesting behavior highlighted in pink to make sure you see it:

SW2#
*Mar 1 00:49:35.757: set portid: VLAN0001 Fa1/0/1: new port id 8003
*Mar 1 00:49:35.757: STP: VLAN0001 Fa1/0/1 -> listening
*Mar 1 00:49:36.873: STP: VLAN0001 new root port Fa1/0/1, cost 38
*Mar 1 00:49:36.873: STP: VLAN0001 sent Topology Change Notice on Fa1/0/1
*Mar 1 00:49:36.873: STP[1]: Generating TC trap for port FastEthernet1/0/2
*Mar 1 00:49:36.873: STP: VLAN0001 Fa1/0/2 -> blocking
*Mar 1 00:49:36.890: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
*Mar 1 00:49:37.754: %LINK-3-UPDOWN: Interface FastEthernet1/0/1, changed state to up
*Mar 1 00:49:38.761: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0/1, changed state to up
*Mar 1 00:49:50.765: STP: VLAN0001 Fa1/0/1 -> learning
*Mar 1 00:50:05.772: STP[1]: Generating TC trap for port FastEthernet1/0/1
*Mar 1 00:50:05.772: STP: VLAN0001 Fa1/0/1 -> forwarding
*Mar 1 00:50:05.780: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
SW2#

I wanted to highlight the state message showing the interface being put into Blocking, even before the new interface is in a forwarding state (or even close), as in the first debug output it does not mention anything about Blocking state in the debug output.

In not so hot pink terms, this means you can verify if a Port is in “Blocking” state via debugs if it is being placed into Blocking from a different State, but not when a Blocking port is transitioned out of Blocking into a non-Blocking state other than it going into a “Listening” state.

This is also a way to indicate if you are on the Root bridge, as a Root Bridge will never, ever, ever ever ever put a Port into Blocking state!

Verifying SW2 interface Fa1/0/2 is back into BLK state

SW2#sh span

VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0017.5aa8.a600
Cost 38
Port 3 (FastEthernet1/0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

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

Interface Role Sts Cost Prio.Nbr Type
——————- —- — ——— ——– ——————————–
Fa1/0/1 Root FWD 19 128.3 P2p
Fa1/0/2 Altn BLK 19 128.4 P2p

SW2#

And Fa1/0/2 is back where it was in a Blocking state, and STP is working its magic.

 

One last verification command to determine the Root Bridge

 

“sh span root” on the CLI from the perspective of SW2 (non-Root) vs SW4 (Root):

SW2 (Non-Root)

SW2#sh span root

Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
—————- ——————– ——— —– — — ————
VLAN0001 32769 0017.5aa8.a600 38 2 20 15 Fa1/0/1
SW2#

SW4 (Root Bridge)

SW4#sh span root

Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
—————- ——————– ——— —– — — ————
VLAN0001 32769 0017.5aa8.a600 0 2 20 15
SW4#

The output is a bit squished so I highlighted in red demonstrating on non-Root bridges, that it will display the Root Port with “sh span root”, whereas when you are on the Root Bridge there will be no interface there because the Root Bridge has no Root Ports!

And that’s it for this post!

That is all for this post, I’ve edited it a bit to split up some of the information, next I will go into how ports are selected for blocking in the switched network and what determining factors drive that selection!