Modifying STP Timers

Recall that STP uses three timers to keep track of various port operation states and communication between bridges. The three STP timers can be adjusted by using the commands documented in the sections that follow. Remember that the timers need to be modified only on the Root Bridge because the Root Bridge propagates all three timer values throughout the network as fields in the configuration BPDU.

Manually Configuring STP Timers

Use one or more of the following global configuration commands to modify STP timers:

Switch(config)# spanning-tree [vlan vlan-id] hello-time seconds Switch(config)# spanning-tree [vlan vlan-id] forward-time seconds Switch(config)# spanning-tree [vlan vlan-id] max-age seconds

Notice that the timers can be changed for a single instance (VLAN) of STP on the switch by using the vlan vlan-id parameters. If you omit the vlan keyword, the timer values are configured for all instances (all VLANs) of STP on the switch.

The Hello timer triggers periodic "hello" (actually, the configuration BPDU) messages that are sent from the root to other bridges in the network. This timer also sets the interval in which a bridge expects to hear a hello relayed from its neighboring bridges. Configuration BPDUs are sent every 2 seconds, by default. You can modify the Hello timer with the hello-time keyword, along with a value of 1 to 10 seconds, as in the following command:

Switch(config)# spanning-tree hello-time 1

The Forward Delay timer determines the amount of time a port stays in the Listening state before moving into the Learning state, and how long it stays in the Learning state before moving to the Forwarding state. You can modify the Forward Delay timer with the forward-time keyword. The default value is 15 seconds, but this can be set to a value of 4 to 30 seconds. This timer should be modified only under careful consideration because the value depends on the diameter of the network and the propagation of BPDUs across all switches. A value that is too low allows loops to form, possibly crippling a network.

The Max Age timer specifies a stored BPDU's lifetime that has been received from a neighboring switch with a designated port. Suppose that BPDUs are being received on a nondesignated switch port every 2 seconds, as expected. Then an indirect failure, or one that doesn't involve a physical link going down, occurs that prevents BPDUs from being sent. The receiving switch waits until the Max Age timer expires to listen for further BPDUs. If none is received, the nondesignated port moves into the Listening state, and the receiving switch generates configuration BPDUs. This port then becomes the Designated Port to restore connectivity on the segment.

To modify the Max Age timer, use the max-age keyword. The timer value defaults to 20 seconds but can be set from 6 to 40 seconds.

Automatically Configuring STP Timers

Modifying STP timers can be tricky, given the conservative nature of the default values and the calculations needed to derive proper STP operation. Timer values are basically dependent on the Hello Time and the switched network's diameter, in terms of switch hops. Catalyst switches offer a single command that can change the timer values in a more controlled fashion. Although 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. This global configuration command has the following syntax:

Switch(config)# spanning-tree vlan vlan-list root {primary I secondary} [diameter diameter [hello-time hello-time]]

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. If you do not specify a Hello Time, the default value of 2 seconds is assumed.

This command can be used only on a per-VLAN basis, to modify the timers for a particular VLAN's spanning tree instance. The network diameter can be a value from one to seven switch hops. Because this command makes a switch become the Root Bridge, all the modified timer values resulting from this command will be propagated to other switches through the configuration BPDU.

As an example, suppose that a small network consists of three switches connected in a triangle fashion. The command output in Example 9-6 shows the current (default) STP timer values that are in use for VLAN 100.

Example 9-6 Displaying the STP Timer Values in Use

Switch# show spanning-tree vlan 100

VLAN0100

Spanning

tree enabled

protocol ieee

Root ID

Priority

100

Address

000c.8554.9a80

This bridge

is the root

Hello Time

2 sec Max Age 20

sec

Forward Delay

15 sec

Bridge ID

Priority

100 (priority 0

sys

id-ext 100)

Address

000c.8554.9a80

Hello Time

2 sec Max Age 20

sec

Forward Delay

15 sec

Aging Time

300

[output omitted]

The longest path that a packet can take through the sample network is three switches. This is considerably less than the reference diameter of seven that is used to calculate the default timer values. Therefore, you can safely assume that this network diameter is three, provided that no additional switches will be added to lengthen the longest path. Suppose that a Hello Time of 1 second is also desired, to shorten the time needed to detect a dead neighbor. The following command attempts to make the local switch become the Root Bridge and automatically adjusts the STP timers:

Switch(config)# spanning-tree vlan 100 root primary diameter 3 hello-time 1

You can confirm the new timer values with the show spanning-tree vlan vlan-id command, as demonstrated in Example 9-7.

Example 9-7 Confirming STP Timer Configuration Changes

Switch(config)# spanning-tree vlan 100 root primary diameter 3 hello-time 1

You can confirm the new timer values with the show spanning-tree vlan vlan-id command, as demonstrated in Example 9-7.

Switch# show spanning-tree vlan 100

VLAN0100

Spanning

tree enabled

protocol ieee

Root ID

Priority

100

Address

000c.8554.9a80

This bridge

is the root

Hello Time

1 sec Max Age

7

sec

Forward Delay 5 sec

Bridge ID

Priority

100 (priority

0

sys

id-ext 100)

Address

000c.8554.9a80

Hello Time

1 sec Max Age

7

sec

Forward Delay 5 sec

Aging Time

300

+1 -1

Responses

  • luigi
    Why forward delay is only 15 seconds in STP timers?
    3 years ago
  • leon
    What keyword in macro command is used to configure a root bridge?
    2 years ago

Post a comment