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.
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