Spanning Tree Topology Tuning and Optimization

For Spanning Tree Protocol (STP) to have optimum performance and functionality, the Spanning Tree topology should be strategically designed, considering the hardware used, its resiliency, redundancy, and the whole network topology. In addition, implementing STP tuning and optimization can influence and improve the Spanning Tree algorithm.


Spanning Tree Topology Root Bridge

When designing, the STP root bridge should be a core switch, and a secondary root bridge should also be assigned. The root switch is typically placed at the Layer 2/Layer 3 boundaries and should have minimal hops to the furthest switch in the topology.

The root bridge priority must have the lowest possible value, and the secondary root bridge priority value must be slightly higher. All other switches must have a way higher priority value. Enabling the root guard prevents other switches from becoming the root switch.

Using the following commands will set the root priority:

  1. spanning-tree vlan vlan-id priority priority

The priority value can be between 0 to 61,440, with increments of 4,096. It is best practice to set the primary root bridge value to 0 since it is the lowest priority value. The secondary root bridge would have a 4,095 priority value.

  1. spanning-tree vlan vlan-id root {primary | secondary} [diameter]

Using the ‘primary’ keyword would automatically set the priority to 24,576 and ‘secondary’ would set the root bridge priority to 28,672. The ‘diameter’ keyword is optional. It can be used to modify the timers.


Spanning Tree Port Cost

The total Spanning Tree topology path cost incorporates calculating the metric to the root plus the cost of the STP port that receives the Bridge Protocol Data Units (BPDUs). The total path cost determines the designated and blocked port, thus influencing the STP tree and the forwarding path.

The STP port cost can be modified using the command:

spanning tree [vlan vlan-id] cost cost

The port ‘cost’ value will be the value that will be added to the metric. Lowering the port cost value where the Bridge Protocol Data Unit (BPDU) is received will decrease the total STP path cost. This will make an alternate port a designated port. Increasing the value would turn designated ports into blocking ports. The ‘vlan’ keyword is optional and is used to modify the cost of a specific VLAN.


Spanning Tree Port Priority

The alternate port is selected utilizing the STP port priority if there are multiple links between the switches. So when the root port fails, the switch will choose a link from the multiple links to become the next root port.

Choosing the alternate port uses the system ID, port cost, port priority, and port number. The system ID and the port cost would typically be the same, so port priority and number would be the tie-breakers.

The upstream switch influences the port priority and the port number. Therefore the configuration for the port priority will be entered on the upstream switch. For example, if the root port in Switch 1 fails and there are multiple links connecting to Switch 2, then the port priority configuration will be on Switch 2.

The command used to modify the port priority is:

spanning-tree [vlan vlan-id] port-priority priority

The ‘vlan’ keyword is optional and is used to modify the priority of a specific VLAN.

Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.

We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: