Each port on a switch using STP will be in one of the following states: Blocked, Listening, Learning, Forwarding, or Disabled. During the initialization of the switch, all the ports will start up in the blocked state. Then the port moves through each of the next three states. The exception to this rule is when Portfast is enabled. The port will go from blocked to forwarding and skip the states of listening and learning. Portfast should never be enabled on any port directly connected to another switch.
Blocked means that none of the ports is going to transmit or receive any data, but they will listen to the BPDUs. The BPDU carries various pieces of information in the form of timers. These timers control spanning tree's activity and help spanning tree decide which port is blocked, which port is listening, and what the spanning tree topology should be.
The second state is the Listening state. The switch listens for frames but doesn't learn or act on them while it is in the listening state. The switch does receive the frames but discards them before any action is taken. MAC addresses are not placed into the CAM table while the port is listening.
The third state is the Learning state. The switch will start to learn the MAC addresses it can see and populate its CAM table with the addresses and the ports on which they were found. In this state, the switch will start to transmit its own BPDUs.
The fourth state is the Forwarding state. The switch has learned MAC addresses and populated its CAM table with this information along with which ports are associated with the MAC addresses. The switch can now forward traffic among the various ports.
In the Disabled state, the switch port is virtually shut down. The port will receive BPDUs but will not forward them to the switch processor. It discards all incoming frames from both the port and other forwarding ports on the switch.
The amount of time it takes for a switch to go through the first four states is called the Forward Delay and generally runs about 50 seconds. The default timers used for the Forward Delay can be adjusted through various timer settings on the switch. However, changing the timers is not recommended unless the engineer understands STP well and the impacts of changing the timers.
|Blocked to listening
|Listening to learning
|Learning to forwarding