Thursday, 2 May 2019

STP Timers


It's possible to change some STP timers to improve convergence times for Spanning Tree. 

The most common ones are:
  • Hello
  • Max age
  • Forward delay
  • Diameter

Definitions:
Hello - periodic 'hello' which contains the BPDU config. This timer is also used as the expected time for a hello to be received. Default time for hello's are 2 seconds.

Max Age - specifies the time it stores the BPDU received. If the receiving switch stops receiving BPDU's from its root port, it will wait for the max age to expire before switching the non-designated ports into listening state. At the same time it will also transition itself as the root bridge and start sending BPDU's.

Forward Delay - this timer is used for transitioning states for both Listening-Learning & Learning-Forwarding. Default is 15 seconds. Changing this value to a low number could potentially cause loops in the network. 


Diameter - it's one I am not too familiar with. See below info from the Cisco link in references. 
diameter of the STP domain (dia)—This value is the maximum number of bridges between any two points of attachment of end stations. The IEEE recommendation is to consider a maximum diameter of seven bridges for the default STP timers.

From <https://www.cisco.com/c/en/us/support/docs/lan-switching/spanning-tree-protocol/19120-122.html#tune>


Further reading on Diameter, this is completely dependent on your network design. It's the distance to reach from one switch to another (taking the longest route possible).

Using my lab, the diameter configuration is done below:
Highest diameter is 3 as this is a small lab.
Configuring the Diameter will auto configure other timings. (Max Age and Forward Delay).
There is no way to see the diameter configuration in the running config. I would say it's similar to a macro command. 
SwitchC(config)#spanning-tree vlan 1 root primary ?
  diameter  Network diameter of this spanning tree

SwitchC(config)#spanning-tree vlan 1 root primary diameter ?
  <2-7>  Maximum number of bridges between any two end nodes


Before and after configuring Diameter on the root bridge:
SwitchC#show span vlan 1

VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    32769
             Address     0c18.a511.d600
             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     0c18.a511.d600
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

SwitchC(config)#spanning-tree vlan 1 root primary diameter 3
SwitchC(config)#^Z

SwitchC#show span vlan 1

VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    24577
             Address     0c18.a511.d600
             This bridge is the root
             Hello Time   2 sec  Max Age 12 sec  Forward Delay  9 sec

  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)
             Address     0c18.a511.d600
             Hello Time   2 sec  Max Age 12 sec  Forward Delay  9 sec
             Aging Time  300 sec

Manually configuring the timers:
SwitchC(config)#spanning-tree vlan 1 ?
  forward-time        Set the forward delay for the spanning tree
  hello-time        Set the hello interval for the spanning tree
  max-age        Set the max age interval for the spanning tree
  priority        Set the bridge priority for the spanning tree
  root                Configure switch as root
  <cr>



SwitchC(config)#spanning-tree vlan 1 forward-time ?
  <4-30>  number of seconds for the forward delay timer

SwitchC(config)#spanning-tree vlan 1 hello-time ?
  <1-10>  number of seconds between generation of config BPDUs

SwitchC(config)#spanning-tree vlan 1 max-age ?
  <6-40>  maximum number of seconds the information in a BPDU is valid



More Labbing:
Changing the timers seem to apply locally but they do not take effect as it will use the Root Bridge timings. Using the same diagram above, I have changed settings for SwitchB in the below.
In my lab setup, switches are running RSTP but the configuration should be the same.

SwitchB(config)#span vlan 1 forward-time 6
SwitchB(config)#span vlan 1 hello-time 10

SwitchB#show span vlan 1

VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    24577
             Address     0c18.a511.d600
             Cost        4
             Port        2 (GigabitEthernet0/1)
             Hello Time   2 sec  Max Age 12 sec  Forward Delay  9 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0c18.a59a.dc00
             Hello Time  10 sec  Max Age 20 sec  Forward Delay  6 sec
             Aging Time  300 sec

SwitchB#debug spanning-tree bpdu

You can see it forwarding BPDUs to other ports.
It does not use the BPDU timer of 10 seconds configured on local switch.

Logs:
*May  2 14:14:15.847: RSTP(1): sending BPDU out Gi0/2
*May  2 14:14:18.099: RSTP(1): sending BPDU out Gi0/2
*May  2 14:14:20.325: RSTP(1): sending BPDU out Gi0/2



Summary:
The above information is good to know and covers some basics.
It's unlikely that anyone is still using 802.1D in 2019 as most Cisco switches in the past decade have RSTP enabled by default. STP may not be an option anymore.

There are also other methods that'll improve convergence: UplinkFast and BackboneFast which I'll write about in another post. 


References:

No comments:

Post a Comment