The topology in Figure 1 shows three switches with 802.1Q trunks connecting them. There are two VLANs, 10 and 20, that are being trunked across these links. The goal is to configure S3 as the root bridge for VLAN 20 and S1 as the root bridge for VLAN 10. Port F0/3 on S2 is the forwarding port for VLAN 20 and the blocking port for VLAN 10. Port F0/2 on S2 is the forwarding port for VLAN 10 and the blocking port for VLAN 20.
In addition to establishing a root bridge, it is also possible to establish a secondary root bridge. A secondary root bridge is a switch that may become the root bridge for a VLAN if the primary root bridge fails. Assuming the other bridges in the VLAN retain their default STP priority, this switch becomes the root bridge if the primary root bridge fails.
The steps to configure PVST+ on this example topology are:
Step 1. Select the switches you want for the primary and secondary root bridges for each VLAN. For example, in Figure 1, S3 is the primary bridge for VLAN 20 and S1 is the secondary bridge for VLAN 20.
Step 2. Configure the switch to be a primary bridge for the VLAN by using the spanning-tree vlan number root primary command, as shown in Figure 2.
Step 3. Configure the switch to be a secondary bridge for the VLAN by using the spanning-tree vlan number root secondary command.
Another way to specify the root bridge is to set the spanning tree priority on each switch to the lowest value so that the switch is selected as the primary bridge for its associated VLAN.
Notice that in Figure 2, S3 is configured as the primary root bridge for VLAN 20, S1 is configured as the primary root bridge for VLAN 10. S2 retained its default STP priority.
The figure also shows that S3 is configured as the secondary root bridge for VLAN 10, and S1 is configured as the secondary root bridge for VLAN 20. This configuration enables spanning tree load balancing, with VLAN 10 traffic passing through S1 and VLAN 20 traffic passing through S3.
Another way to specify the root bridge is to set the spanning tree priority on each switch to the lowest value so that the switch is selected as the primary bridge for its associated VLAN, as shown in Figure 3. The switch priority can be set for any spanning tree instance. This setting affects the likelihood that a switch is selected as the root bridge. A lower value increases the probability that the switch is selected. The range is 0 to 61,440 in increments of 4,096; all other values are rejected. For example, a valid priority value is 4,096 x 2 = 8,192.
As shown in Figure 4, the show spanning-tree active command displays spanning tree configuration details for the active interfaces only. The output shown is for S1 configured with PVST+. There are a number of Cisco IOS command parameters associated with the show spanning-tree command.
In Figure 5, the output shows that the priority for VLAN 10 is 4,096, the lowest of the three respective VLAN priorities.
Use the Syntax Checker in Figure 6 to configure and verify spanning tree for S1 and S3.