STP STATES AND TIMERS
Based on the data obtained from the exchange of BPDU frames between the switches, the spanning tree is calculated. The ports on the switches change between different states and use three timers when determining the spanning tree.
These port states determine the status of a port as discussed below.
- Blocking state – Any port that is not assigned or the root port is deemed to be in a blocking state. Any port that is not transmitting frames falls under this category. In this port state, the port will only accept BPDU frames to find out where the root bridge is and find out about changes to the topology.
- Listening – When a port is in the listening state, STP typically knows that it can transmit and receive frames. Additionally, ports in the listening state can send and receive BPDU frames to let other switches know that they are potential active STP ports.
- Learning- A port is typically in this condition when it is getting ready to forward frames, and the switch that includes these ports is typically populating its MAC address table.
- Forwarding – The port is often in the forwarding state when it is actively delivering and receiving frames over the network. Additionally, BPDU frames can be sent and received from this port to check for topological changes.
- Disabled – A port is in this state when an administrator has set it up to be in shutdown mode.
We will see the port states as we proceed in this chapter.
In STP Protocol, there are three timers that are used. These determine the state of the switch or port in the STP topology.
- The Hello timer – by default transmitted every 2 seconds
- The Forward delay – by default 15 seconds before transitioning to forwarding
- Maximum age – by default 20 seconds
The Hello timer often serves as a notification to check on the status of a link. A BPDU will be sent to each port in the topology every 2 seconds. This check to see if a port is still active in the STP topology uses the keep-alive method. One can change this value to a value between 1 and 10 seconds.
A switch’s forward delay is the amount of time it takes for it to transition between its listening and learning states. On Cisco switches, this value is set by default to 15 seconds for each state, but an administrator can adjust it to a value between 4 and 30 seconds.
The max age time is the maximum amount of time that a switch port can save BPDU data. This timer can be adjusted to a number between 6 and 40 seconds, while its default value is 20 seconds. STP re-converges by picking a new path when a switch port hasn’t gotten any BPDUs before the maximum age has passed.
Portfast technology
On CISCO switches, some ports that may be connected to user nodes do not need to receive BPDUs and also need to transition immediately to the forwarding state. The CISCO portfast technology is a proprietary technology that allows such ports to transition immediately from blocking state to forwarding state.
STP Convergence
To better understand STP, we need to understand the process a switch takes from boot-up to full convergence.
Step 1. Election of a root bridge.
Step 2. Election of the root ports.
Step 3. Elect designated and non-designated ports.
The switch with the lowest BID wins the election for the root bridge by BPDUs, as we previously indicated. The switch with the lowest BID wins the election and becomes the root bridge. The BID is made up of the switch’s MAC address and the STP priority. As we’ve already noted, for all STA calculations, the root bridge serves as the reference or focal point.
The second step is choosing the root ports. The root ports that were previously explained are the most direct routes to the root bridge. The amount of bandwidth that is accessible on each link determines this.
The specified ports can be used to direct traffic to the root bridge even though they are not root ports. Each link must have a single defined port. The root bridge often has defined ports on each of its ports. After being chosen, STP chooses which links to block.
Ports that aren’t root ports or specified ports are often the ones that STP blocks. These ports are tagged as BLOCKED and won’t operate until one of the principal links fails.
STP process in action.
In this section, we’ll talk about this procedure using the architecture depicted below, and then, using what we’ve learned so far, we’ll figure out the spanning tree root bridge and all the ports following convergence in STP.
The network topology for which the STP ports and the root bridge will be chosen is depicted in the diagram below.
The root bridge is the first item we need to identify. According to the aforementioned topology, AS1 has a priority of 4096 and a mac address of 0005.5E54.6158, AS3 has a mac address of 0060: 3EA1: 167D, and AS4 has a mac address and priority of 0060.3E7B.27EC. This information allows us to deduce that AS1 is the root bridge because its root ID is lower and it has a lower MAC address than AS3.
The Bridge ID value will be added by the additional switches in this topology as the Root ID of AS1.
As the image below shows, all of the ports on AS1 will be designated, while all of the ports on the other switches that connect to AS1 will be root ports.
The designated ports and banned ports for each of the remaining links must then be identified.
According to the topology above, the connection between AS2 and AS4 is a FastEthernet connection; however, because fa0/2 on AS2 has a priority of 12288 and fa0/1 on AS4 has a priority of 4096, fa0/2 on AS2 will be blocked and fa0/1 on AS4 will be designated.
FastEthernet links make up the connection between AS3 and AS4, however since the priority on both switches is the same, the sticky MAC address will be used to break the tie in this case because AS4’s MAC address is lower. As a result, fa0/2 on AS3 will be restricted, whereas fa0/2 on AS4 will be used instead. This is seen below.
This completes the demonstration of the STP process on these switches.