Old CCIE Myths: Spanning-Tree Diameter

VN:F [1.9.6_1107]
Rating: 5.0/5 (2 votes cast)
By Marko Milivojevic on January 24th, 2011

In the light of recent announcement from Cisco that switch troubleshooting is now part of troubleshooting section in CCIE R&S lab, I decided to put some of the switching myths to rest. Today on the menu is one of my all-time favorites: Spanning-tree diameter parameter limits the size of switched network. Let’s see if it’s true…

According to Cisco documentation for Catalyst 3560, here is what Spanning-Tree diameter does. The original text is from IOS 12.2(46)SE documentation:

diameter net-diameter

(Optional) Set the maximum number of switches between any two end stations. The range is 2 to 7.

Another text describing this keyword in a similar, MST-related, command is here:

diameter net-diameter

(Optional) Set the maximum number of switches between any two end stations. The range is 2 to 7. This keyword is available only for MST instance 0.

This description is very misleading and absolutely untrue – which is the very source of the myth. I usually don’t start by claiming that myth is busted, but I feel obliged to do so here. Let’s see why. Before we dive into IOS and BPDU frames, let’s see what some other sources say.

Understanding Diameter

CiscoPress book titled CCNP SWITCH 642-813 Official Certification Guide describes this command as such (emphasis added by me):

[...]As described earlier, the spanning-tree vlan vlan-list root macro command is a better tool to use than setting the timers with the individual commands.
[...]
Here, STP timers will be adjusted according to the formulas specified in the 802.1D standard by giving only the network’s diameter (the maximum number of switches that traffic will traverse across a Layer 2 network) and an optional hello-time.[...]

This is the correct description of what the command does. Why so and what formulas are we talking about here?

The 802.1d-1998 standard specifies several parameters used in calculating various STP parameters in Annex B, “Calculating Spanning Tree parameters”. Careful readers will raise eyebrows and say that the 802.1d-1998 has been superseded by 802.1d-2004, which is true. The newer standard document removes all the calculations from Annex B, declaring them irrelevant since rapid spanning tree doesn’t rely on them. Fair enough for IEEE, but not for CCIE… Let’s take a look at those parameters and formulas.

  • Hello Time:
    • Cisco default: 2 seconds
    • IEEE recommended value: 2 seconds
    • IEEE basis of choice: hello_t = 2 x pdu_d
    • In plain English: Hello timer is twice the value of pdu_d parameter (maximum BPDU transmission delay), which can be calculated as: pdu_d = bt_d. Parameter bt_d is “maximum bridge transit delay”, which IEEE hardcodes at value 1.0 for “IEEE 802 Bridged LANs”.
  • Forward Delay:
    • Cisco default: 15 seconds
    • IEEE recommended value: 15 seconds
    • IEEE basis of choice: 2 * fwd_d >= msg_ao + msg_prop + bt_d + life
    • In plain English: Two Forward Delay times need to be larger than the sum of “maximum Message Age overestimate” (msg_ao), “maximum Bridge Protocol Message propagation time” (msg_prop), “maximum bridge transit delay” (bt_d) and “maximum frame lifetime” (life). A lot of new values have been added, let’s see what they are and how are they calculated.
      • msg_ao = msg_aio * (dia – 1), where msg_aio represents “maximum Message Age increment overestimate” and is approximated to the same value as pdu_d. Default value is therefore 1.0. Parameter dia is our diameter, which defaults to 7.
      • msg_prop = ((lost_msgs + 1) * hello_t) + pdu_d * (dia – 1), where lost_msgs is defined as “maximum number of lost Bridge Protocol Messages to be tolerated prior to reconfiguration”, a value hard-coded at 3.
      • life = (dia * bt_d) + mma_d, where mma_d is “maximum medium access delay”, with recommended value “greater or equal to 0.5″.
    • Now that we know all the parameters and their values, let’s fill in the formula: (1 * (7 – 1)) + (((3 + 1) * 2) + 1 * (7 – 1)) + ((7 * 1) + 0.5) = 27.5. If we use Forward Delay of 15: (2 * 15) >= 27.5, we have satisfied the original requirement.
  • MaxAge:
    • Cisco default: 20 seconds
    • IEEE recommended value: 20 seconds
    • IEEE basis of choice: max_age = msg_ao + msg_prop
    • In plain English: MaxAge needs to be “maximum Message Age overestimate” incremented by “maximum Bridge Protocol Message propagation time”. We know how both of these parameters are calculated from the previous step. When we replace the values in formula: ((3 + 1) * 2) + (1 * (7 – 1)) + (1 * (7 – 1)) = 20.

Diameter in Action

I hope you survived this exploration of IEEE 802.1d-1998. Let’s now jump into seeing this actually work. To do so, I have set-up very simple network as shown on the diagram below.

Diagram

Here is the relevant configuration on all 4 switches:

Cat1:

interface range FastEthernet0/1 - 23 , GigabitEthernet0/1 - 2
 shutdown
!
interface FastEthernet0/24
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport nonegotiate
!
spanning-tree vlan 1 root primary

Cat2:

interface range FastEthernet0/1 - 19 , FastEthernet0/21 - 23 , GigabitEthernet0/1 - 2
 shutdown
!
interface range FastEthernet0/20 , FastEthernet0/24
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport nonegotiate
!

Cat3:

interface range FastEthernet0/1 - 23 , GigabitEthernet0/1 - 2
 shutdown
!
interface FastEthernet0/24
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport nonegotiate
!

Cat4:

interface range FastEthernet0/1 - 23 , GigabitEthernet0/1 - 2
 shutdown
!
interface FastEthernet0/24
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport nonegotiate
!
monitor session 1 source interface Fa0/24
monitor session 1 destination interface Fa0/10 encapsulation replicate

With this configuration, we know that Cat1 should be sending configuration BPDUs every 2 seconds, that MaxAge should be 20 and Forward Delay 15 seconds. This is the default calculation, based on the network diameter of 7. Let’s capture one BPDU and see how it looks like:

Capture-1

We can see that behavior is, indeed, what we expected. Now, what happens if we change diameter to 2? Will those BPDUs reach Cat4? if “diameter” was in any way limiting the actual size of the network, it shouldn’t. In a case it does, let’s calculate values for Forward Delay and MaxAge, using formulas we learned:

2 x fwd_d >= (1 * (2 – 1)) + (((3 + 1) * 2) + 1 * (2 – 1)) + ((2 * 1) + 0.5)
2 x fwd_d >= 12.5

max_age = ((3 + 1) * 2) + (1 * (2 – 1)) + (1 * (2 – 1))
max_age = 10

So, good value for Forward Delay would be 7, since 6 is too small. For MaxAge, we’ll use 10, as calculated. What’s happening on our SPAN port?

Cat1:

spanning-tree vlan 1 root primary diameter 2

Capture-2

It looks like our calculations are correct and not only that, but BPDU actually made it to Cat4!

As an exercise, let’s do the same for diameter of 5.

2 x fwd_d >= (1 * (5 – 1)) + (((3 + 1) * 2) + 1 * (5 – 1)) + ((5 * 1) + 0.5)
2 x fwd_d >= 21.5

max_age = ((3 + 1) * 2) + (1 * (5 – 1)) + (1 * (5 – 1))
max_age = 16

So, here we’ll have to use Forward Delay of at least 11 seconds and MaxAge of 16. Let’s sniff…

Cat1:

spanning-tree vlan 1 root primary diameter 5

Capture-3

You will notice that Forward Delay calculation is not 100% exact. To get the exact value Cisco is using, we would have to know which value is used for mma_d in IOS and that’s outside common knowledge.

I hope you enjoyed this journey into spanning-tree. Oh, of course – busted and I sincerely hope Cisco will fix their misleading documentations on this subject :-).

Happy studies.


Marko Milivojevic – CCIE #18427
Senior Technical Instructor – IPexpert
Join our Online Study List

Old CCIE Myths: Spanning-Tree Diameter, 5.0 out of 5 based on 2 ratings
Share and Enjoy:
  • RSS
  • Twitter
  • Facebook
  • Google Bookmarks
  • Digg
  • Print
  • Technorati
  • Slashdot
  • LinkedIn
  • del.icio.us
  • Reddit
  • Sphinn
  • Mixx
  • Blogplay
  • Netvibes
  • NewsVine
  • Live
  • Ping.fm
  • MySpace
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Tags: , , , ,

8 Responses to “Old CCIE Myths: Spanning-Tree Diameter”

  1. Bojan Zivancevic says:

    Interesting… Basically, the command adjusts the STP timers like the network IS SUPPOSED to be smaller according to our desires. If I get it right, the network will funciton as before, no limitations whatsoever, it’s just the timers that get tweaked, right?

    There is nothing wrong with that, but it will be decent if somebody would mention it in their books… :)

    VA:F [1.9.6_1107]
    Rating: 0.0/5 (0 votes cast)
    • Nick Channing says:

      I guess this solves the argument that Shawn and I were having during the class in RTP. I found it a good explanation of 802.1d -1998 timer calculation in Cisco LAN Switching (p 249 – 260) by Kennedy Clark, though to be honest your explanation is a little more concise and up to date config wise!

      VA:F [1.9.6_1107]
      Rating: 0.0/5 (0 votes cast)
  2. Dan K says:

    What happens if the actual diameter is greater than 7?

    VA:F [1.9.6_1107]
    Rating: 0.0/5 (0 votes cast)
  3. Christian Thorsnes says:

    Nice post Marko — I like the compressed detail of this, should be a good reference should I need to look up the formula’s without having to parse the 2004 802.1d pubs. Thanks!

    VA:F [1.9.6_1107]
    Rating: 0.0/5 (0 votes cast)

Leave a Reply