Spanning TreeGlobal Config

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.

Syntax·Global Config
spanning-tree vlan [id] root primary

When 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 primary
Switch(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 10
VLAN0010
  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    P2p

The 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

1.

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).

2.

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.

3.

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.

4.

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

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions