Lab Objective
Use the root primary and root secondary macro commands to designate one switch as the primary root bridge and a second switch as the backup root, without manually specifying a numeric priority, and verify IOS calculates appropriate values automatically.
Lab Purpose
Manually calculating a priority value low enough to guarantee root status, as done in the previous lab, requires knowing every other switch's current priority in the network. The root primary macro removes this guesswork by having IOS automatically select a priority guaranteed to be lower than the current root's.
Lab Topology
Switch1 (intended primary root)
Switch2 (intended secondary/backup root)
Switch3 (access switch, default priority)
All connected via trunk links in VLAN 1Task 1: Configure Switch1 as Primary Root
Use the macro command to configure Switch1 as the primary root bridge for VLAN 1.
Task 2: Verify the Automatically Assigned Priority
Check what priority value IOS actually assigned to Switch1.
Task 3: Configure Switch2 as Secondary Root
Use the macro command to configure Switch2 as the secondary (backup) root bridge for VLAN 1.
Task 4: Verify Switch2's Assigned Priority
Check what priority value IOS assigned to Switch2, confirming it is higher than Switch1's but still lower than the default.
Task 5: Confirm Root Bridge Status
Confirm Switch1 is recognized as root by all switches in the topology.
Solution and Verification
Switch1(config)# spanning-tree vlan 1 root primary
Switch1# show spanning-tree vlan 1 | include Priority
Bridge ID Priority 24576
-- IOS automatically selected 24576, a value
-- guaranteed to be lower than any other
-- switch's current priority at the time this
-- command was issued -- no manual calculation
-- was requiredSwitch2(config)# spanning-tree vlan 1 root secondary
Switch2# show spanning-tree vlan 1 | include Priority
Bridge ID Priority 28672
-- IOS assigned 28672 -- lower than the default
-- 32768 (so Switch2 still outranks a plain
-- default-priority switch), but higher than
-- Switch1's 24576, ensuring Switch2 only
-- becomes root if Switch1 failsSwitch1# show spanning-tree vlan 1 | include Root
Root ID Priority 24576
This bridge is the root
Switch3# show spanning-tree vlan 1 | include Root
Root ID Priority 24576
Root has priority 24576
-- Every switch in the topology correctly
-- agrees Switch1 is rootKey Takeaway
The root primary and root secondary macros calculate an appropriate priority automatically based on the current network state at the moment the command runs, rather than requiring the administrator to survey every switch's existing priority first — but this also means the assigned value is only guaranteed relative to conditions at that exact moment, so a later switch added with an even lower manual priority could still displace the intended root.