Site is Under Maintenance
Please come back again in...
00 Days
00 Hours
00 Minutes
00 Seconds

Spanning-Tree Protocol (STP) Root Bridge Configuration Tutorial

In the Per VLAN Spanning-Tree (PVST) tutorial, I discussed how we elect a root bridge for each VLAN. In this tutorial, we'll explore various options for configuring the root bridge for your switched environment.

1. Configuration

Here is our topology:


As you can see in the above diagram, we have three switches, and on each switch, we'll configure three VLANs:

Configurations for SW1, SW2, and SW3

SW1, SW2 & SW3
(config)#vlan 10
(config)#vlan 20
(config)#vlan 30
Let's check the bridge IDs for our switches:

SW1#show spanning-tree bridge detail 
VLAN0001         
  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     5254.001a.935a
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0010         
  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     5254.001a.935a
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0020         
  Bridge ID  Priority    32788  (priority 32768 sys-id-ext 20)
             Address     5254.001a.935a
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0030         
  Bridge ID  Priority    32798  (priority 32768 sys-id-ext 30)
             Address     5254.001a.935a
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
SW2#show spanning-tree bridge detail
VLAN0001         
  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0010         
  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0020         
  Bridge ID  Priority    32788  (priority 32768 sys-id-ext 20)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0030         
  Bridge ID  Priority    32798  (priority 32768 sys-id-ext 30)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
SW3#show spanning-tree bridge detail
VLAN0001         
  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     5254.001d.e6bb
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0010         
  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     5254.001d.e6bb
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0020         
  Bridge ID  Priority    32788  (priority 32768 sys-id-ext 20)
             Address     5254.001d.e6bb
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0030         
  Bridge ID  Priority    32798  (priority 32768 sys-id-ext 30)
             Address     5254.001d.e6bb
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
The default priority value for a switch is 32768, which means that if no other configuration is applied, the MAC address becomes the tiebreaker in the root bridge election. In this scenario, SW2 ends up being the root bridge for all VLANs.

+What is the significance behind the number 32768 being used for a switch's default priority? Why such a number?

Here is our output:

SW2#show spanning-tree vlan 10

VLAN0010
  Spanning tree enabled protocol ieee
  Root ID    Priority    32778
             Address     5254.0015.bc74
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  15  sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p 
SW2#show spanning-tree vlan 20

VLAN0020
  Spanning tree enabled protocol ieee
  Root ID    Priority    32788
             Address     5254.0015.bc74
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32788  (priority 32768 sys-id-ext 20)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p
SW2#show spanning-tree vlan 30

VLAN0030
  Spanning tree enabled protocol ieee
  Root ID    Priority    32798
             Address     5254.0015.bc74
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32798  (priority 32768 sys-id-ext 30)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p 
Let's see what we can do about this. I want to now configure my network so it looks like this:


To change the root bridge for each VLAN using the spanning-tree command, you have several options. Here's how you can do it:

1. Set the Bridge PriorityYou can modify the priority of the switch for a specific VLAN. A lower priority value increases the chances of becoming the root bridge.

Switch(config)# spanning-tree vlan [VLAN_ID] priority [PRIORITY_VALUE]
For example, to set the priority for VLAN 10 to 20480:

Switch(config)# spanning-tree vlan 10 priority 20480
2. Specify the Root BridgeYou can explicitly designate a switch as the root bridge for a specific VLAN using the following command:

Switch(config)# spanning-tree vlan [VLAN_ID] root primary
This command sets the switch as the root bridge if it has the lowest bridge ID among all switches for that VLAN. For example, to make the switch the root for VLAN 20:

Switch(config)# spanning-tree vlan 20 root primary
Alternatively, to configure another switch as the root bridge for a specific VLAN, use:

Switch(config)# spanning-tree vlan [VLAN_ID] root secondary
3. View Current ConfigurationsTo see the current Spanning-Tree configuration and the root bridge for each VLAN, use the command:

Switch# show spanning-tree
4. Adjusting the MAC AddressIn situations where you need to maintain the same priority but want to change the root bridge, you can change the switch's MAC address (not common, but possible):

Switch(config)# mac-address [NEW_MAC_ADDRESS]
These commands help to manage the STP topology effectively, allowing for optimized load balancing and redundancy across the entire network.

If we run the command spanning-tree vlan 10 ? Appending the question mark ('?'), you can view additional options:

SW1(config)#spanning-tree vlan 10 ?    
  forward-time  Set the forward delay for the spanning tree
  hello-time    Set the hello interval for the spanning tree
  max-age       Set the max age interval for the spanning tree
  priority      Set the bridge priority for the spanning tree
  root          Configure switch as root
Above, we see two options:
  • priority: We can manually change the bridge priority.
  • root: We can configure the switch as root.
Let me ask you this: what's the difference between these two parameters?

Let's find out!

The spanning-tree vlan command also accepts ranges of VLANs.

2. Root Parameter

The root parameter in the STP refers to the designated switch that serves as the central point of the Spanning-Tree topology for each VLAN. This switch is called the "root bridge." The root bridge plays a critical role in managing the STP process to ensure that there are no loops in the network. It serves as the reference point for all other switches, which calculate their roles based on their distances from this central switch.

The election process for the root bridge is based on bridge priority and MAC address. By default, all switches have a priority of 32768, and in cases where multiple switches share the same priority, the switch with the lowest MAC address becomes the root. This mechanism ensures a systematic approach to establishing the root bridge, but network administrators can influence this outcome.

With protocols like Per VLAN Spanning-Tree (PVST), it is possible to have different root bridges for different VLANs. This capability allows for optimized load balancing across the network since one switch can serve as the root for one VLAN while another switch serves as the root for a different VLAN. Such flexibility can significantly improve network performance (although may allow for more broadcast storms).

You can manually configure a switch to become the root bridge for your specific VLAN by adjusting its priority using commands like spanning-tree vlan [VLAN_ID] priority [PRIORITY_ID] or by designating it as a primary root bridge. The choice of the root bridge is crucial, as it can greatly impact the efficiency and redundancy of the network. A strategically chosen root bridge minimizes the number of blocked ports and enhances the overall traffic flow.

In summary, the root parameter signifies the switch that is elected to manage the Spanning-Tree topology for a VLAN. This role is vital for influencing traffic flow and ensuring optimal performance in any network.

With that being said, let's check our options:

SW1(config)#spanning-tree vlan 10 root ?
  primary    Configure this switch as primary root for this spanning tree
  secondary  Configure switch as secondary root
I can configure the switch to become the primary or secondary root bridge. Let's go with making it a primary:

SW1(config)#spanning-tree vlan 10 root primary
Now, let's check and see if that worked:

SW1#show spanning-tree vlan 10

VLAN0010
  Spanning tree enabled protocol ieee
  Root ID    Priority    24586
             Address     5254.001a.935a
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    24586  (priority 24576 sys-id-ext 10)
             Address     5254.001a.935a
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  15  sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p
In the output above, we can see that SW1 has been designated as the root bridge for VLAN 10, with its priority set to 24586. To further enhance network reliability and load balancing, we can configure another switch, SW2, to act as the "secondary" root bridge. This can be achieved by adjusting the priority on SW2, ensuring it has a higher priority value than SW1 but still lower than the default value of 32768.

To configure SW2 as the secondary root bridge, you would typically enter the following command in the configuration mode:

SW2(config)#spanning-tree vlan 10 root secondary
To configure SW2's priority, use the following command:

SW2(config)#spanning-tree vlan 10 priority 28672
Let's check and see what this command does:

SW2#show spanning-tree vlan 10

VLAN0010
  Spanning tree enabled protocol ieee
  Root ID    Priority    24586
             Address     5254.001a.935a
             Cost        4
             Port        1 (GigabitEthernet0/0)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    28682  (priority 28672 sys-id-ext 10)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Root FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p
In the above output, we see that the priority of SW2 has been set to 28682; however, it's important to note and understand that there is no official designation for a "secondary" root bridge in spanning-tree protocols. Instead, when you configure a switch with the root primary or root secondary parameters in Cisco IOS, the system automatically adjusts the priority values accordingly behind the scenes, so to speak.

To verify this, we can examine the configuration of SW2. By using the command show running-config, we can see how the priority has been set when the root primary or root secondary command was issued and applied. This will show us the specific priority values assigned to the switch, confirming that the underlying mechanisms is designed to facilitate the selection of a backup root bridge without explicitly labeling it as such.

This way, while the concept of a secondary root bridge is useful for understanding redundancy, the actual implementation is handled through priority settings that determine which switch will assume the root role in the event of a failure.

Let's verify this by looking at our running-configuration:

SW1#show running-config | include priority              
spanning-tree vlan 10 priority 24576
SW2#show running-config | include priority
spanning-tree vlan 10 priority 28672
The way this mechanism operates is that the switch evaluates the priority of the current root bridge and then lowers its own priority to ensure it can become the new root bridge. When a switch is configured with the root primary or root secondary commands, it calculate a priority that is either lower than the existing root bridge's priority, or set to a specific value designed to ensure it takes over the root role when necessary.

By doing this, the switch effectively positions itself as the preferred candidate for the root bridge in the Spanning-Tree topology. If the current root bridge fails or becomes unreachable, the switch with the adjusted priority will automatically be elected as the new root, maintaining network stability and minimizing disruptions. This dynamic adjustment is essential for ensuring redundancy and optimizing traffic flow within your network.

3. Priority Parameter

SW3#show spanning-tree vlan 30

VLAN0030
  Spanning tree enabled protocol ieee
  Root ID    Priority    30
             Address     5254.001d.e6bb
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    30     (priority 0 sys-id-ext 30)
             Address     5254.001d.e6bb
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p
As the output above shows, we can see that SW3 is now the root bridge for the VLAN 30. That's really all there is to it, folks!

Conclusion

In this tutorial, you have learned how to:
  • Verify the current root bridge for each VLAN.
  • Configure the root bridge using the show spanning-tree
    command by utilizing the root parameter.
  • Adjust the root bridge configuration using the priority parameter.
I hope you found this tutorial informative. If you have any questions or need further clarification, please feel free to drop us a comment below!

Happy STP Root Bridging!

Rate This Article

Thanks for reading: Spanning-Tree Protocol (STP) Root Bridge Configuration Tutorial, Sorry, my English is bad:)

Getting Info...

About the Author

I'm Aevon...Just a gal with an insane passion for all things cybersecurity. 17 years in the industry and still love what I'm doing.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.