# Maximum Spanning Tree Diameter

(2019-07-11)

#### What is the maximum diameter of a spanning tree?

By default, the maximum number of link hops two switches can be apart is 7.

#### Can we have it bigger?

Spanning-Tree Protocol includes several timers that control various aspects regarding how frequently BPDU packets are sent and how long information can exist before it is removed from the switches bridge table. Of these timers, Cisco suggests that only 4 of them should ever be modified: hello, max age, forward delay, and diameter. I've included a table describing these values below. Timer values are in seconds.

Name | Range | Default | Description |
---|---|---|---|

hello | 1 - 10 | 2 | This is the interval between BPDU updates on a port. |

max age | 6 - 40 | 20 | The maximum length of time before a bridge port saves its information. |

forward delay | 4 - 30 | 15 | The time spent in the listening and learning state. |

diameter | - | 7 | The maximum number of bridges (switches) between any two end points on the network. |

There are two essential equations used to determine the proper values for the max age and forward delay timers:

```
max age = (4 * hello) + (2 * diameter) – 2
forward delay = ((4 * hello) + (3 * diameter)) / 2
```

If we solve these equations for diameter, we can use the maximum values of the max age and forward delay timers to determine how large the network can be.

```
diameter = (max age + 2 - (4 * hello)) / 2
diameter = ((2 * forward delay) - (4 * hello)) / 3
```

If we plug 40 into max age and 30 into forward delay, we get diameters of 17 and 17.3 respectively. In both cases, we can decrease the hello interval from 2 to 1 to get a slight bump in diameter (19 and 18.7). Decreasing the hello interval is an option but presents certain risks. Mainly, the doubling of BPDU traffic will increase the load on the switch's processor as it works to process more information. Whether or not you can decrease this timer is a function of what model switch you are using in your network.

**The answer is 18 if you make the changes as above.**

If you scrolled down to the bottom of the page looking for this information, remember that this maximum is based on setting max age and forward delay to their maximum values and decreasing the hello timer to 1.