STP cost to root

Unanswered Question
Jul 2nd, 2008

Many of the STP commands give you a "cost" value as part of their output. I'm trying to decipher between which of these is a cost of the interface and which is the cumulative cost to reach the root. Is there a command that will specifically show me the cost to the root? Can you get an output that shows costs the way a routing table output would?


  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
zztopping Wed, 07/02/2008 - 06:59

"sh spanning-tree root" will give you the root cost to the bridge. This is the cumulative cost to get to the root.

you can google a chart to see the speed of each interface and its corresponding cost. 1gig="4" and 100mbps = "19"

Francois Tallet Wed, 07/02/2008 - 09:18

The cumulative cost to the root is something that is a characteristic of the STP instance as a whole. You will thus see it at the top of the show spantree/spanning-tree display, along with the root id, timers etc...

The cost on a port is characteristic... of the port;-) You will see this information along with other port information like the role and the state.

So the keyword is identical (cost), but where it is displayed in the output makes it easy to differentiate between the two.



Giuseppe Larosa Wed, 07/02/2008 - 11:38

Hello Jason,

as told in other posts you can find the cost to the root on top of sh spanning-tree vlan

you can check the STP cost of an interface looking at the last lines of the same show

STP Root can be different for different vlans (PVST+ = Per Vlan Spanning Tree)

If you want to understand how the cumulative cost is calculated make a drawing of a network of switches.

The key point is that the cost is calculated in ingress as entering the port : for a non-root switch the root port is the port with the lowest cumulative cost to the root bridge.

Cost on port X = (cumulative cost received on Port X) + Port X.cost

So cost to root for the root bridge itself is zero.

Cost to reach the root from a switch directly connected to the root is:

0 + cost of incoming interface

if the root port of switch SWj has cost N this value is reported on the STP BPDUs that are sent out by Swj on all its non root ports that are in forwarding state.

If SWk is connected to SWj it will calculate the cost as N + its own interface's cost.

And so on.

Standards costs are based on interface speed with bigger cost for slower interfaces.

hope to help



This Discussion