How to configure Spanning Tree Protocol Root Primary and Root Secondary for Selecting Root Switch (Root Bridge)
To configure a Switch to become the Spanning Tree Protocol (STP) Root Bridge (Root Switch) for a VLAN, you can use the “spanning-tree vlan <vlan-id> root” command from the Global Configuration Mode.
When you enter “spanning-tree vlan <vlan-id> root” command, IOS will check the Switch Priority values of the Root Bridges (Root Switches) for each VLAN. If all the switches in the VLAN have the same default priority, IOS will configure the Spanning Tree Priority value as 24576. If any Root Bridge (Root Switch) for the specified VLAN has a Switch Priority value lower than 24576, the switch sets its own priority for the specified VLAN to 4096 less than the lowest Spanning Tree Switch Priority value.
To configure a Switch as a Root Bridge (Root Switch) using "spanning-tree vlan <vlan_id> root primary" command, follow these steps.
omnisecu.com.SW1>enable omnisecu.com.SW1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. omnisecu.com.SW1(config)#spanning-tree vlan 1 root primary omnisecu.com.SW1(config)#exit omnisecu.com.SW1#
To configure a Switch as a Secondary candidate for Root Bridge (Root Switch) using "spanning-tree vlan <van_id> root secondary" command follow these steps.
omnisecu.com.SW2>enable omnisecu.com.SW2#configure terminal Enter configuration commands, one per line. End with CNTL/Z. omnisecu.com.SW2(config)#spanning-tree vlan 1 root secondary omnisecu.com.SW2(config)#exit %SYS-5-CONFIG_I: Configured from console by console omnisecu.com.SW2#exit
Cisco IOS Show command "show spanning-tree" will show the changed Switch Priority value as below.
omnisecu.com.SW1#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 24577
Address 000A.F379.A66C
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24577 (priority 24576 sys-id-ext 1)
Address 000A.F379.A66C
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi1/1 Desg FWD 4 128.25 P2p
Gi1/2 Desg FWD 4 128.26 P2p