When we configure the Spanning Tree Protocol on Cisco Switches, we usually use the spanning-tree vlan priority command when selecting Root Bridge Switch.
How to Configure Root Primary in Cisco Switch
The Spanning Tree Protocol (802.1D) was developed to prevent loops from Layer 2 Cisco Switches operating on the OSI layer 2. We can manually select Root Bridge on Cisco Switches with standard STP protocol or Rapid Spanning Tree Protocol enabled.
There are two methods to select a Manual Root Bridge Switch. The first method is to change the Priority value of the Switch. The second method is to use and configure the Root Primary command.
When Root Bridge is selected using the Root Primary command on Cisco Switches, the Priority values of the Switches are automatically adjusted.
How to Select Root Bridge in Cisco Switch
Using the GNS3 program, configure Cisco Layer 2 Switches on a small network topology with Primary/Secondary commands.
Step 1
Open the GNS3 program and create a new project as shown in the image below. Then, add Layer 2 Switches to the GNS3 workspace as shown below.
Step 2
Specify the Cisco Switch to select the Root Bridge, and then define the Switch closest to the Root Bridge as the Secondary Root Bridge. Then, run all Layer 2 Switches in the GNS3 workspace and open the CLI command prompt windows.
Step 3
Priority values are 32769 when Cisco Switches are first added to the network. Therefore, you can change the Priority values manually or automatically.
To select Root Bridge with this command on the Cisco Switches you have specified in GNS3, perform the following command at the CLI prompt of the L2-SW-1 Switch in the network topology, and then examine the show spanning-tree output.
L2-SW-1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
L2-SW-1(config)#spanning-tree vlan 1 RP
L2-SW-1(config)#exit
L2-SW-1#
L2-SW-1#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 24577
Address 00b4.349f.fe00
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 00b4.349f.fe00
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 Shr
Gi0/1 Desg LIS 4 128.2 Shr
Gi0/2 Desg FWD 4 128.3 Shr
Gi0/3 Desg FWD 4 128.4 Shr
L2-SW-1#
After selecting Root Bridge, you can see the Priority value of the L2-SW-1 Switch set.
Step 4
Use the following command to select Cisco Switch L2-SW-2 as the second root bridge and check the Priority value with the show spanning-tree command.
L2-SW-2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
L2-SW-2(config)#spanning-tree vlan 1 root secondary
L2-SW-2(config)#exit
L2-SW-2#
L2-SW-2#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 24577
Address 00b4.349f.fe00
Cost 4
Port 1 (GigabitEthernet0/0)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 28673 (priority 28672 sys-id-ext 1)
Address 00b4.3451.da00
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 Root FWD 4 128.1 Shr
Gi0/2 Desg FWD 4 128.3 Shr
Gi0/3 Desg FWD 4 128.4 Shr
L2-SW-2#
We have configured Cisco Switch L2-SW-2 as a Secondary Root Bridge. If you remove the L2-SW-1 Switch over the network, the Root Bridge will be the L2-SW-2 Switch.
Step 5
You can see that the Priority values change automatically in the Cisco Switch L2-SW-1 and L2-SW-2 show running-config command output.
Show Commands
L2-SW-1#show running-config
Building configuration...
Current configuration : 4770 bytes
!
! Last configuration change at 07:49:43 UTC Mon Sep 25 2017
!
version 15.0
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
service compress-config
!
hostname L2-SW-1
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
!
!
ip cef
no ipv6 cef
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
spanning-tree vlan 1 priority 24576
!
vlan internal allocation policy ascending
!
!
!
interface GigabitEthernet0/0
media-type rj45
negotiation auto
!
interface GigabitEthernet0/1
media-type rj45
negotiation auto
!
interface GigabitEthernet0/2
media-type rj45
negotiation auto
!
interface GigabitEthernet0/3
media-type rj45
negotiation auto
!
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
!
!
!
line con 0
line aux 0
line vty 0 4
!
!
end
L2-SW-1#
L2-SW-2#show running-config
Building configuration...
Current configuration : 4770 bytes
!
! Last configuration change at 07:50:32 UTC Mon Sep 25 2017
!
version 15.0
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
service compress-config
!
hostname L2-SW-2
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
!
!
!
ip cef
no ipv6 cef
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
spanning-tree vlan 1 priority 28672
!
vlan internal allocation policy ascending
!
!
!
interface GigabitEthernet0/0
media-type rj45
negotiation auto
!
interface GigabitEthernet0/1
media-type rj45
negotiation auto
!
interface GigabitEthernet0/2
media-type rj45
negotiation auto
!
interface GigabitEthernet0/3
media-type rj45
negotiation auto
!
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
!
line con 0
line aux 0
line vty 0 4
!
!
end
L2-SW-2#
L2-SW-3#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 24577
Address 00b4.349f.fe00
Cost 4
Port 3 (GigabitEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 00b4.3453.4900
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 Shr
Gi0/1 Desg FWD 4 128.2 Shr
Gi0/2 Root FWD 4 128.3 Shr
Gi0/3 Altn BLK 4 128.4 Shr
L2-SW-3#
L2-SW-4#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 24577
Address 00b4.349f.fe00
Cost 4
Port 3 (GigabitEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 00b4.3497.7d00
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 Shr
Gi0/1 Altn BLK 4 128.2 Shr
Gi0/2 Root FWD 4 128.3 Shr
Gi0/3 Desg FWD 4 128.4 Shr
L2-SW-4#
How to Choose Root Bridge ⇒ Video
You can watch the video below to use Cisco Root Primary/Secondary commands on Layer 2 Switches and subscribe to our YouTube channel to support us!
Conclusion
In this article, we manually selected the root bridge and secondary bridge using the GNS3 root primary. Thanks for following us!