Thursday, October 16, 2014

IEEE 802.1D STP Port States


My previous blog post discussed the basic concepts and the operation of STP, describing STP as a link management protocol that provides link redundancy, while preventing loops. In order to guarantee that there will no loops (even temporarily), STP cannot immediately transition ports from disabled to forwarding. When STP reconverges, ports must wait for new topology information to propagate through the network before starting to forward frames. There are five different states that a port can move through: 

  • Blocking
  • Listening
  • Learning
  • Forwarding
  • Disabled

Each port state has a specific purpose, and lasts for the length of the ForwardDelay timer (by default, 15 seconds).

Blocking State

A port in the blocking state does not participate in frame forwarding. When an interface is enabled (and STP is on), it always enters the blocking state, and a BPDU is sent. Initially, the switch announces itself as the root, until it exchanges BPDUs with other switches. The BPDU exchange establishes which switch is actually the root switch. 

A port in the blocking state performs as follows:
  • discards frames received on the port
  • does not learn MAC addresses
  • receives BPDUs

Listening State

Listening state is the first transitional state a port enters after the blocking state. The port transitions into this state, when STP determines that it should participate in frame forwarding. In essence, the listening state is functionally equivalent to the blocking state, but the port begins to transition into the forwarding state. 

A port in the listening state performs as follows:
  • discards frames received on the port
  • does not populate the CAM table
  • receives BPDUs

Learning State

A port enters into the learning state from the listening state, and prepares to participate in frame forwarding. 

A port in the learning state performs as follows:
  • discards frames received on the port
  • starts populating the CAM table
  • receives BPDUs

Forwarding State

A port enters into the forwarding state from the learning state. The port in forwarding state is fully converged, and forwards frames. 

A port in the forwarding state performs as follows:
  • receives and forwards frames
  • learns MAC addresses
  • receives BPDUs

Disabled State

A port in the disabled state does not participate in frame forwarding or in the operation of STP. A port in the disabled state is effectively nonoperational.


Slow Convergence

Because STP goes through all the previously mentioned states when a link comes up, it takes 30-50 seconds for a port to become operational and start transmitting traffic. This is considered slow by today’s standards. 

Let’s look at the debug output from a switch, and examine what STP does when a port is brought up. As mentioned, the port will remain in each state for the length of the ForwardDelay timer, 15 seconds by default. Pay attention to the time stamps. 

ASW1# debug spanning-tree events

*Oct 16 13:21:48.603: STP: VLAN0003 Et0/2 -> listening
*Oct 16 13:22:03.603: STP: VLAN0003 Et0/2 -> learning
*Oct 16 13:22:18.615: STP: VLAN0003 Et0/2 -> forwarding

No comments:

Post a Comment