Classic STP Convergence

Port States 

  • Topology changes can take place in a switched network due to a link coming up or going down.
  • If a port transitions directly to the forwarding state, it can create a temporary loop. 
  • Ports must wait for new topology information to propagate before they can start forwarding frames.
  • At any given time, each port on a switch using STP is in one of these states: Blocking, Listening, Learning, Forwarding, or Disabled.
  • A port moves through these states:
    • Initialization to blocking
    • Blocking to listening or disabled
    • Listening to learning or disabled
    • Learning to forwarding or disabled
    • (Forwarding to disabled)


  • Every switch in the network goes through the blocking state and the transitory states of listening and learning at power up. If properly configured, each port stabilizes into the forwarding or blocking state.
  • A summary of the behavior of each port state:
    • Blocking (stable/transitory): discards frames, does not learn MAC addresses, receives BPDUs but does not send them (20 seconds by default - Max Age, if in transitory state)
    • Listening (transitory): discards frames, does not learn MAC addresses, receives and sends BPDUs (15 seconds by default - Forward Delay)
    • Learning (transitory): discards frames, learns MAC addresses, receives and sends BPDUs (15 seconds by default - Forward Delay)
    • Forwarding (stable): forwards frames, learns MAC addresses, receives and sends BPDUs
    • Disabled: does not participate in frame forwarding or STP.
  • It can take a port up to 50 seconds to move into the forwarding state: Blocking (20 seconds) + Listening (15 seconds) + Learning (15 seconds) = 50 seconds.


Purpose of the Topology Change Mechanism

  • Learning from the frames it receives, a switch creates a Layer 2 forwarding table associating the host to the connected port by its MAC address (aka MAC address table or CAM table). 
  • This table is used to forward frames directly to their destination port, and flooding is avoided.
  • Default aging time for the MAC address table is 300 seconds (5 minutes). 
  • Only after a host has been silent for 5 minutes, its entry disappears from the MAC address table. 


  • The diagram above illustrates a stable STP topology with the link between B1 and B4 blocking. The simplified MAC address table indicates that A and B can be reached through ports A and B on each device, respectively. 
  • Now, assume the link between B2 and B3 fails.


  • A and B will not be able to communicate at least until B1 puts its port to B4 in forwarding mode (a maximum of 50 seconds with default parameters).
  • Even then, when A wants to send a frame to B, B1 still has an entry that leads to B2 and the packet is sent to a black hole.
  • Communication is lost for 5 minutes, until the entries for A and B MAC addresses age out.
  • The topology change mechanism is a workaround for that kind of problem.
  • After a topology change, each switch is notified and reduce the MAC address aging time to a lower value (Forward Delay = 15 seconds by default).
  • Topology changes are normal in STP. But, too many of them can have an impact on network performance.
  • What is considered a topology change? The exact definition is:
    • When a port that was forwarding is going down (blocking for instance).
    • When a port transitions to forwarding and the switch has a designated port. (This means that the switch is not standalone.)
  • The process to send a notification to all bridges in the network involves two steps:
    • The switch notifies the root bridge of the spanning tree.
    • The root bridge "broadcasts" the information into the whole network.


Notifying the Root Bridge

  • In normal STP operation, a switch keeps receiving configuration BPDUs from the root bridge on its root port. But, it never sends out a BPDU towards the root bridge.
  • For this purpose, a special BPDU called the topology change notification (TCN) BPDU has been introduced. 
  • When a switch needs to signal a topology change, it starts to send TCNs on its root port.
  • The (upstream) designated switch receives the TCN, acknowledges it, and generates another one for its own root port. 
  • The process continues until the TCN hits the root bridge.
  • The TCN BPDU is a very simple BPDU that contains absolutely no information that a switch sends out every Hello time seconds (this is the locally configured Hello time, not the Hello time specified in configuration BPDUs).
  • The designated switch acknowledges the TCN by immediately sending back a normal configuration BPDU with the topology change acknowledgement (TCA) bit set. 
  • The switch that notifies the topology change does not stop sending its TCN BPDUs until the designated switch has acknowledged it.



Broadcasting the Event to the Network

  • Once the root is aware that there has been a topology change event in the network, it starts to send out its configuration BPDUs with the topology change (TC) bit set.
  • These BPDUs are relayed by every switch in the network with this bit set.
  • As a result, all switches become aware of the topology change situation and reduce their MAC address aging time to Forward Delay (15 seconds by default).
  • The TC bit is set by the root bridge for a period of Max Age + Forward Delay seconds, which is 20+15=35 seconds by default.


Documentation
Understanding Spanning Tree Protocol Topology Changes
Configuring Spanning Tree

Comments