Cisco Support Community
Community Member

STP cost to root

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?


Community Member

Re: STP cost to root

"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"

Re: STP cost to root

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.



Hall of Fame Super Silver

Re: STP cost to root

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


CreatePlease to create content