For configuring a specific switch as Root Bridge, the bridge ID priority value must be adjusted to make sure as lower than all the bridge priority values of all the other switches on the network. There are two different methods to configure the bridge priority value on a Cisco Catalyst switch.
To ensure that the switch has the lowest bridge priority value, use the spanning-tree vlan vlan-id root primary command in global configuration mode. The command set the priority for the switch to the predefined value of 24,576 or the highest multiple of 4,096, less than the lowest bridge priority detected on the network.
We can also configure the alternate root bridge to use the command “spanning-tree vlan vlan-id root secondary” command in global configuration mode. The predefined bridge priority value for the secondary root bridge is 28,673.
The value ensures the alternate switch becomes the root bridge if the primary root bridge going fails. This configuration is done assuming that the rest of the switches in the network have the default 32,768 priority value defined.
Now look at the figure above, Switch-1 is elected as Root Bridge in the spanning tree process. The bridge ID priority is the same in all switches which are 32769. The switch-1 MAC address is the lowest among all switches.
So, spanning tree was elected switch-1 as a Root Bridge based on the lowest MAC address. But we want to configure switch-3 as the root bridge and switch-2 is the secondary root bridge. The configuration of switch-3 for root bridge is as under:-
Switch-3(config)#spanning-tree vlan 1 root primary
Switch-3(config)# do wr
Now we will configure the switch-2 as the secondary root bridge. If the primary root bridge becomes faulty the switch will act as the root bridge immediately and the network should no need to elect the root bridge. The configuration of switch-2 is as under:-
Switch-2(config)#spanning-tree vlan 1 root secondary
Switch-2(config)# do wr
Now we can verify the configuration all switches. The output of the “show spanning-tree” command on all switches is as under:
Another method for root bridge configuration is the configuration bridge priority value. The command used for configuring the bridge priority value is “spanning-tree vlan vlan-id priority value” in global configuration mode. The priority value is configured in the increase of 4,096, and the range is between 0 and 61,440.
Now I am going to cancel the previous command in both switch-3 and switch2 and want to configure the bridge priority values. The switch-3 configuration is as under:-
Switch-3# no spanning-tree vlan 1 root primary
Switch-3(config)#spanning-tree vlan 1 priority 24576
Switch-3(config)# do wr
We can do the same for the secondary root bridge. To verify the bridge priority of a switch we can use the same “show spanning-tree” command. After configuring the root bridge priority of the switch-3, the output of the show spanning-tree command is the following:-
The priority of the switch has been set to 24,576. Also, notice that the switch is designated as the root bridge for the spanning-tree instance. We can see the Bridge Id Priority is set 24577 because it is the 24576 +1 = 24577. The 1 is the value of the VLAN which is added to the bridge priority to construct extended system ID.