The STP process works by default on Cisco switches and begins with the root switch election. The election is based on the bridge IDs (BIDs) sent in the BPDUs. Each switch that participates in STP will have a 8-byte switch ID that comprises of the following fields:
- 2-byte priority field – by default, all switches have the priority of 32768. This value can be changed using configuration commands.
- 6-byte system ID – a value based on the MAC address of each switch.
A switch with the lowest BID will become a root switch, with lower number meaning better priority.
Consider the following example:
As mentioned above, the switch with the lower BID wins. Since by default all switches have the BID priority of 32768, the second comparison has to be made – the lowest MAC address. In our example SW1 has the lowest MAC address and becomes the root switch.
For simplicity, all ports on switches in the example above are assigned to VLAN 1. Also, note that STA adds the VLAN number to the priority value, so all switches actually have the BID priority of 32,769.
To influence the election process, you can change the BID priority to a lower value on a switch you would like to become root. This can be done using the following command:
(config)#spanning-tree vlan ID priority VALUE
The priority must be in increments of 4096, so if you choose any other value, you will get en error and possible values listed:
(config)#spanning-tree vlan 1 priority 224 % Bridge Priority must be in increments of 4096. % Allowed values are: 0 4096 8192 12288 16384 20480 24576 28672 32768 36864 40960 45056 49152 53248 57344 61440 (config)#spanning-tree vlan 1 priority 4096
Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.
We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: