Hands-On Lab: Configuring Spanning Tree Root Bridges Using the IOS Macro Command

This hands-on lab uses the spanning-tree root primary and root secondary macro commands to configure a primary and backup root bridge without manually calculating priority values, and verifies IOS automatically selects an appropriate priority relative to the current root.

Spanning Tree Root MacroRoot Primary SecondaryAutomatic Priority Calculation

~3 دقیقه مطالعه · آخرین به‌روزرسانی ۳۱ شهریور ۱۴۰۵

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 1

Task 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 required

Switch2(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 fails

Switch1# 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 root

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

نوشته و پژوهش‌شده توسط دکتر شاهین صیامی

مقالات مرتبط

Hands-On Lab: Final Comprehensive CCNP Troubleshooting Challenge (BGP, DMVPN, and QoS Integration)

This hands-on lab presents a complex multi-layer failure across an integrated BGP-over-DMVPN topology combined with QoS marking, requiring systematic diagnosis of a route reflector misconfiguration, an NHRP registration failure, and an incorrectly applied QoS policy simultaneously affecting the same network.

ادامه

Hands-On Lab: Configuring BGP over DMVPN

This hands-on lab runs iBGP as the routing protocol across the same DMVPN hub-and-spoke topology used in the two previous labs, configuring the hub as a route reflector so spokes learn each other's routes without a full iBGP mesh, combining two previously separate concepts into one integrated design.

ادامه

Hands-On Lab: Configuring OSPF over DMVPN

This hands-on lab runs OSPF as the dynamic routing protocol across the same DMVPN hub-and-spoke topology, configuring the tunnel interface as an OSPF point-to-multipoint network type to correctly handle the hub-and-spoke adjacency pattern without requiring the broadcast network type's DR/BDR election.

ادامه

Hands-On Lab: Configuring EIGRP over DMVPN

This hands-on lab runs EIGRP as the dynamic routing protocol across the DMVPN hub-and-spoke topology built in earlier labs, verifying neighbor relationships form correctly across the multipoint tunnel and routes propagate without requiring per-spoke static configuration on the hub.

ادامه

Hands-On Lab: Configuring HSRP MD5 Authentication

This hands-on lab configures MD5 authentication on an HSRP group, verifying two routers with matching authentication strings form a normal active/standby relationship while a router with a mismatched string is excluded from the group entirely.

ادامه

Hands-On Lab: Configuring Cisco Umbrella-Style DNS Security via DNS Forwarding Redirection

This hands-on lab configures a router to redirect all client DNS queries toward a security-focused DNS resolver using DNS forwarding interception, approximating cloud-delivered DNS security enforcement without requiring per-client configuration changes.

ادامه