STP - spanning-tree root primary command
One of the fundamental mechanisms of Spanning Tree Protocol (STP) is the election of a root bridge. Using the spanning-tree vlan x root primary
command, it is possible to designate the local switch as the root bridge for the specified VLAN. Now what this command actually does is a little more involved than simply designating it the root bridge.
The spanning-tree root primary
command in Cisco IOS operates by running a hardwired script that adjusts the switch's priority to make it the root bridge for a specified VLAN. The behavior of this command affects the priority values in various ways, depending on the IOS version and platform. According to the linked Cisco documentation below:
- IOS 15.X: The switch sets its priority to 24576 to become the root for the specified VLAN. If another switch has a lower priority, it sets its priority to 4096 less than the lowest priority.
- IOS 12.X: The command sets the bridge priority to 8192. If the switch does not become the root, the priority is adjusted to 100 less than the current root's priority. If it still does not become the root, an error occurs.
- Other Documentation: The
primary
keyword sets the priority to 24576, and thesecondary
keyword sets it to 28672.
In all cases, the command runs a script that examines the current root bridge and adjusts the local switch's priority to make it the root. This script runs only when the command is executed and does not automatically re-run if the network topology changes, meaning the command is not preemptive.
This behavior ensures that the local switch becomes or remains the root bridge when the command is executed. Depending upon the configuration found on other switches in the STP topology, this command may actually fail to fulfil its requirement, therefore it should be used cautiously, with a clear knowledge of the configuration found on other switches in the topology.
Links
https://networklessons.com/spanning-tree/spanning-tree-root-bridge-configuration