Spanning tree port costs

Anyone familiar with STP will likely have most of this table memorized:

8021d-1998-costs.png

The costs in the table are recommended by the IEEE in section 8.10.2 the 802.1D standard published in 1998 (available for free at the IEEE website). However, the standard apparently makes no mention of the formula used to arrive at these costs; if anyone can shed some light on this, please leave a comment. The 1998 standard allows for a 16-bit path cost value (held in software), 1 to 65535, and a 32-bit root path cost (the cost which is advertised in a BPDU field).

Its successor, 802.1D-2004, increases the path cost to a 32-bit value, providing far more granularity in assigning costs, and enabling the use of a static scale. Section 17.14 includes the following table:

8021d-2004-costs.png

The following excerpt provides some insight:

The recommended values for any intermediate link speed can be calculated as 20,000,000,000/(Link Speed in Kb/s). Limiting the range of the Path Cost parameter to 1-200,000,000 ensures that the accumulated Path Cost cannot exceed 32 bits over a concatenation of 20 hops.

By expanding the range of port costs, the 2004 standard allows for a simple inverse scale of bandwidth to cost (e.g. a port with ten times the bandwidth of another has one-tenth its cost). As per the standard, we can see the ceiling of the configurable port cost has been raised from 65,535 to 200,000,000 in more recent IOS releases:

Switch(config-if)# spanning-tree vlan 1 cost ?
  <1-200000000>  Change an interface's per VLAN spanning tree path cost 

About the Author

Jeremy Stretch is a freelance networking engineer, instructor, and the maintainer of PacketLife.net. He currently lives in Fairfax, Virginia, on the edge of the Washington, DC metro area. Although primarily an R&S guy, he likes to get into everything, and runs a free network training lab out of his basement for fun. You can contact him by email or follow him on Twitter.

Leave a Comment


Register to comment as a member. You'll look cooler.

Optional; will not be displayed publicly or given out.

No commercial links. Only personal (e.g. blog, Twitter, or LinkedIn) and/or on-topic links, please.
The 'V' in VLAN stands for _____.