What is the best method of ensuring that your preferred switch is the root bridge?

Redundant links are used to provide a backup path when one link goes down but a Redundant link can sometimes cause switching loops. The main purpose of Spanning Tree Protocol (STP) is to ensure that you do not create loops when you have redundant paths in your network. 

Spanning Tree Protocol (STP) – 
As IEEE STP is used to make a loop-free network by monitoring the network to track all the links and shut down the redundant ones. These are some important terms related to Spanning Tree Protocol: 

 

  • Bridge Priority Data Unit (BPDU) – It contains the Bridge ID, Sender’s Bridge ID, Cost to the Root Bridge, Timer values on Root Bridge. All switches exchange BPDU in order to elect root bridge. The switch with the lowest Bridge ID become the root bridge.
  • Bridge ID – It is an 8-byte field that is a combination of bridge priority (2 bytes) and Base Mac address (6 bytes) of a device. If there is a tie on bridge priority then the Base Mac address is considered.
  • Bridge Priority – It is a priority, which is assigned to every switch, 32768 by default.
  • Root Bridge – The root bridge is the bridge with the lowest Bridge ID. All the decisions like which ports are the root ports (the port with the best path to the root bridge) are made from the perspective of the root bridge.
  • Path cost – A switch may encounter one or more switches in the path to the root bridge. All the paths are analyzed and the path with the lowest cost will be selected. 
     
SpeedLink Cost10 Mbps100100 Mbps191 Gbps410 Gbps2

Designated port – The port which sends the best BPDU i.e ports on the root bridge will be in a forwarding state. 
Root port – The port which receives the best BPDU on a non-root bridge. Criteria for selecting root port: 
 

  1. Lowest path cost to reach the root bridge
  2. Lowest sender bridge ID
  3. Lowest sender port ID

(Port priority + Port number) – Port priority is by default 128 and port number is the switch interface number. 

Election procedure – 
All the switches in the network declare themselves root bridges and start exchanging their own BPDU. The BPDU with the lowest bridge ID is considered as superior. Now the switch receiving the superior BPDU makes changes in its own BPDU and carries forward to its neighbours. It changes the value of root Bridge ID with its superior BPDU bridge ID. This process goes on until all the switches are satisfied with which bridge has the lowest bridge ID and hence that switch will be declared as the root bridge. 

Now according to the criteria, the root ports will be selected and then the port left will be in blocking mode. 

Example – 

 

What is the best method of ensuring that your preferred switch is the root bridge?

Here is a small topology with three switches switch A (mac address-0000.0ACA7.A603), switch B(0030.F222.2794), and switch C(000A.41D5.7937) with all having default priority (32768). 

I am adding vlan 160 to the network, and have successfully done so PROVIDED that I severed the link between switch 1 and switch 5, so

interface TenGigabitEthernet1/0/1
 description uplink c2960x-4 port Te 1/0/1
 switchport trunk allowed vlan 2,12,110,160,170
 switchport trunk native vlan 999
 switchport mode trunk
 switchport nonegotiate
!
interface TenGigabitEthernet1/0/2
 description uplink c2960x-1 port Te 2/0/2
 switchport trunk allowed vlan 2,12,110,170
 switchport trunk native vlan 999
 switchport mode trunk
 switchport nonegotiate
!

Now, I read some things but I'm having a hard time discerning which command is allocating the root switch. For some reason, the readout for c2960x-3 is

C2960X-3#show spanning-tree summary
Switch is in pvst mode
Root bridge for: VLAN0005, VLAN0010, VLAN0100, VLAN0147, VLAN0160
EtherChannel misconfig guard            is enabled
Extended system ID                      is enabled
Portfast Default                        is disabled
Portfast Edge BPDU Guard Default        is disabled
Portfast Edge BPDU Filter Default       is disabled
Loopguard Default                       is disabled
PVST Simulation Default                 is enabled but inactive in pvst mode
Bridge Assurance                        is enabled but inactive in pvst mode
UplinkFast                              is disabled
BackboneFast                            is disabled
Configured Pathcost method used is short

Name                   Blocking Listening Learning Forwarding STP Active
---------------------- -------- --------- -------- ---------- ----------
VLAN0002                     0         0        0         23         23
VLAN0012                     0         0        0         20         20
VLAN0110                     0         0        0         20         20
VLAN0160 0 0 0 3 3 VLAN0170 0 0 0 20 20 ---------------------- -------- --------- -------- ---------- ---------- 5 vlans 0 0 0 86 86

After I severed vlan160 for switches 1 and 5, I got successful comms for vlan160 out of #3, and have since reestablished the vlan on the trunk and comms stayed up.

If I have a large amount of these vlan160 connections coming into switch 1 instead of switch 3, should I allocate that as the root bridge?

What determines which switch will be the root bridge?

An election process determines which switch becomes the root bridge. Each switch has a Bridge ID (BID) that is made up of a priority value, an extended system ID, and the MAC address of the switch. All switches in the network take part in the election process.

How would a switch determine that another switch is now the root bridge?

When adjacent switches receive a BPDU frame, they compare the root ID from the BPDU frame with the local root ID. If the root ID in the received BPDU is lower than the local root ID, the switch updates the local root ID and the ID in its BPDU messages. These messages indicate the new root bridge on the network.

How will switches find the best paths to the root bridge?

Explanation: After the election of a root bridge has occurred, each switch will have to determine the best path to the root bridge from its location. The path is determined by summing the individual port costs along the path from each switch port to the root bridge.