The first step in STP is the root bridge selection. From there all other STP decisions are made.
- The key to Spanning-Tree Protocol is that a root bridge must be selected to become the focal point in the network
- All STP decisions in the network are made from the point-of-view of the root bridge
- Each VLAN must have its own root switch since each VLAN is its own broadcast domain
- This can be one switch or various switches on your network
- To select a root switch, you can choose it as the administrator, or you can let the switches decides (risky)
- It doesn't have to be the most powerful switch, but it should be the most centralized switch
- Set the bridge priority to make it the root switch
- BPDUs (bridge protocol data units) are used to exchange information between switches
- In STP root switch selection, less is better. If a switch sees a neighboring switch with a lower root ID then it will stop the advertisement of its root ID and accept its neighbor as the root switch
- The version of STP must be chosen and all switches must use the same version
- Determine the root bridge
- lowest bridge ID becomes root
- bridge ID is a concatenation of bridge priority and MAC address
- bridge priority is configurable in increments of 4096. default bridge priority is 32768
- bridge priorities are compared to determine root bridge. if equivalent than MAC addresses are compared to break the tie
- To manually set the Bridge ID Priority:
config t spanning-tree vlan 10 priority 8192
- To make the switch the root for the vlan and set its own bridge ID:
config t spanning-tree vlan 10 root primary
- Here is the selection process. Remember that one root switch is identified per-VLAN:
- The root switch is identified per-VLAN
- STP Rule 1 - All ports of the root switch must be in forwarding mode
- Next, all non-root switches determine the single best path to get to the root switch by comparing information in the BPDUs received from neighboring switches
- The BPDU with the least amount of information becomes the root port
- STP Rule 2 - The root port must be set to forwarding mode
- A designated switch is then chosen. It is the switch closest to the root switch through which frames will be forwarded to the root
- STP Rule 3 - In a single LAN segment, the port of the designated switch that connects to that LAN segment must be placed in forwarding mode.
- STP Rule 4—All the other ports in all the switches (VLAN-specific) must be placed in blocking mode. The rule only applies to ports that connect to other bridges or switches. STP does not affect ports that connect to workstations or PCs. These ports remain forwarded.
- By default, spanning tree runs on every port. The spanning tree feature cannot be turned off in switches on a per-port basis. Although it is not recommended, you can turn off STP on a per-VLAN basis, or globally on the switch. Extreme care should be taken whenever you disable spanning tree because this creates Layer 2 loops within the network.