Lesson Contents
In the Per VLAN Spanning Tree (PVST) lesson, I explained that we elect a root bridge for each VLAN. In this lesson, I’ll show you different options to configure the root bridge.
Configuration
Here is the topology we’ll use:
We have three switches. On each switch, I configure three VLANs:
SW1, SW2 & SW3
(config)#vlan 10
(config)#vlan 20
(config)#vlan 30
And we’ll configure the interfaces as trunk interfaces:
SW1, SW2 & SW3
(config)#interface range GigabitEthernet 0/0 - 1
(config-if-range)#switchport trunk encapsulation dot1q
(config-if-range)#switchport mode trunk
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 priority has a default value of 32768 so without configuring anything, the MAC address is the tie-breaker. In my case, SW2 is the root bridge for all VLANs:
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 that. I want to configure my network so it looks like this:
We can change the root bridge for each VLAN with the spanning-tree
command. Here are our 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.
What’s the difference between these two parameters? Let’s find out.
spanning-tree vlan
command also accepts ranges of VLANs.Root Parameter
We’ll start with the root parameter. 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 try primary:
SW1(config)#spanning-tree vlan 10 root primary
Let’s check whether that works:
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 see that SW1 is now the root bridge for VLAN 10. The priority of SW1 is now 24586.
We can also configure another switch to become the “secondary” root bridge. Let’s try that on SW2:
SW2(config)#spanning-tree vlan 10 root secondary
Let’s check 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
Above, we see that the priority of SW2 is now 28682. In reality, there is no such thing as a “secondary” root bridge.
What happens is that behind the scenes, Cisco IOS sets a priority when you use the root primary
or root secondary
parameters. We can verify this by looking at our 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 works is that the switch looks at the priority of the current root bridge and then decreases its own priority so that it becomes the new root bridge.
Priority Parameter
We can also configure the priority manually like this:
SW2(config)#spanning-tree vlan 20 priority ?
<0-61440> bridge priority in increments of 4096
Let’s try that on SW2 for VLAN 20:
SW2(config)#spanning-tree vlan 20 priority 0
By setting the priority to 0, I’ll have the lowest possible priority. Let’s check whether SW2 is now the root bridge for VLAN 20:
SW2#show spanning-tree vlan 20
VLAN0020
Spanning tree enabled protocol ieee
Root ID Priority 20
Address 5254.0015.bc74
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 20 (priority 0 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
Above, we see that the priority is now 20 (priority 0 and sys-id-ext 20). Let’s configure SW3 to become the root bridge for VLAN 30:
SW3(config)#spanning-tree vlan 30 priority 0
Here’s the output of SW3:
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
And as we can see above, SW3 is the root bridge for VLAN 30. That’s all there is to it.
Conclusion
You have now learned how to:
- Verify the current root bridge per VLAN.
- Configure the root bridge using the
spanning-tree
command:- Using the
root
parameter. - Using the
priority
parameter.
- Using the
I hope you enjoyed this lesson. If you have any questions please leave a comment.
may i know what u have updated in this lesson compared to previous article ??
Hi everyone
what tips or practices do you use to search for root bridges quickly
in a network with 290 switches
thank you
Hello Giovanni
In order to find the root bridge, you can issue the
... Continue reading in our forumshow spanning-tree
command, and this will show you the root bridge for each VLAN configured on the switch. You’ll get something like this:Hello Michael
The valid values for bridge priorities in STP are between 0 and 61440. Hpwever, the value must be in increments of 4096. So in practice, the valid values for bridge priorities are: 0, 4096, 8192, 12288, …, up to 61440.
Have you ever wondered why they’re in increments of 4096? It’s not a coincidence that the VLAN ID is a 12-bit value, which can represent up to 4096 VLAN IDs. The reason is because for every VLAN you have a different priority.
In the original 802.1D standard for Spanning Tree Protocol, the 2-byte (16-bit) Priority field in the BPD
... Continue reading in our forumHello, everyone.
I have a question about the
spanning-tree vlan x root primary
command.A lot of resources say that if default priorities aren’t being used, the switch where this command was issued will use a priority that is lower by 4096 than the root bridge’s priority.
However, in my Cisco CML lab, I’ve encountered something I didn’t expect.
Consider this example
ROOT BRIDGE - 24576:0000:0000:0002
Another switch - 32768:0000:0000:0001
If I issue the root primary command on the second switch, it doesn’t change it’s priority to be lower by 4096 than the root b
... Continue reading in our forum