spanning-tree vlan [id] root primary
This command configures a switch as the root bridge for a specific VLAN by setting its bridge priority to 24576 (or lower if another switch has a lower priority), ensuring it becomes the root bridge in the Spanning Tree Protocol (STP) topology.
spanning-tree vlan [id] root primaryWhen to Use This Command
- When designing a redundant network, you want a specific core switch to be the root bridge for VLAN 10 to control the STP topology and prevent suboptimal paths.
- After adding a new switch to the network, you need to force a particular switch to become the root bridge for VLAN 20 to maintain consistent traffic flow.
- During network troubleshooting, you need to manually set the root bridge for VLAN 30 to stabilize STP after a topology change.
- In a multi-VLAN environment, you want to distribute root bridge roles across different switches for load balancing.
Command Examples
Setting root bridge for VLAN 10
Switch(config)# spanning-tree vlan 10 root primarySwitch(config)#
No output is displayed upon successful execution. The command sets the bridge priority for VLAN 10 to 24576, making this switch the root bridge unless another switch has a priority lower than 24576.
Verifying root bridge status after configuration
Switch# show spanning-tree vlan 10VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24576
Address 0011.2233.4455
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24576 (priority 24576 sys-id-ext 10)
Address 0011.2233.4455
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi0/1 Desg FWD 4 128.1 P2p
Gi0/2 Desg FWD 4 128.2 P2pThe output shows that this bridge is the root for VLAN 10. The Root ID and Bridge ID both have priority 24576 and the same MAC address, confirming root status. Interface roles are 'Desg' (designated) and states are 'FWD' (forwarding).
Understanding the Output
The 'show spanning-tree vlan [id]' command displays STP information for a specific VLAN. The 'Root ID' section shows the root bridge's priority and MAC address. If 'This bridge is the root' appears, the local switch is the root. The 'Bridge ID' section shows the local switch's priority (including the system ID extension for the VLAN) and MAC address. Interface details include role (Root, Desg, Altn, Back, etc.) and state (FWD, BLK, LRN, LIS). A healthy STP topology should have one root bridge per VLAN, with all other switches having a root port in forwarding state. Watch for unexpected root bridges or blocked ports that may indicate misconfiguration.
CCNA Exam Tips
CCNA exam tip: The 'spanning-tree vlan [id] root primary' command sets the priority to 24576, but if another switch already has a lower priority, it will set the priority to 4096 less than that switch's priority (minimum 1).
CCNA exam tip: Remember that the root bridge selection is based on lowest bridge priority (priority + VLAN ID). The default priority is 32768, so setting to 24576 ensures it becomes root unless another switch has a priority lower than 24576.
CCNA exam tip: You can also use 'spanning-tree vlan [id] root secondary' to set priority to 28672, making the switch the backup root bridge.
CCNA exam tip: The command does not produce any output on success; always verify with 'show spanning-tree' to confirm root status.
Common Mistakes
Mistake 1: Forgetting to specify the VLAN ID, which causes the command to fail or apply to all VLANs incorrectly.
Mistake 2: Assuming the command immediately changes the root bridge without considering that STP convergence takes time (forward delay).
Mistake 3: Using 'spanning-tree vlan [id] root primary' on a switch that is already the root, which has no effect but may cause confusion.
Related Commands
show spanning-tree
Displays the Spanning Tree Protocol (STP) state and configuration for all VLANs or a specific VLAN, used to verify root bridge, port roles, and STP topology.
spanning-tree vlan [id] priority [value]
Sets the bridge priority for a specific VLAN to influence the root bridge election in Spanning Tree Protocol (STP).
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions