Spanning-Tree Protocol (STP)

This week is time to talk about Networking.
Spanning Tree Protocol(from now STP) is a link management protocol that operate in layer 2 and provides path redundancy while preventing loops in the network.
A loop in the network is caused by:

1st) Duplicated messages that can be placed in both sides of the switch.

2nd) Multiple active paths.

3rd) If duplicated messages are running through the network can produce a loop.

The above causes generate the following problems:

  • Broadcast storms
  • MAC table instability
  • Multiple Frame Transmission

This is an example of network without STP

If STP is not implemented, every bridge will assume itself as root. From here, it will start the change of information producing the above kind of failures.

There is a useful flash presentation to explain how is produced.

Bridge Protocol Data Units (from now BPDU) are frames that contains STP protocol information.  BPDU allow for switches  obtain information about each other. The protocol establish and ID per switch and choose the one with higher priority as root switch. This root switch will establish the minor cost path.  Each port have a configured parameter (Span path cost).  After that, all switches that connect into a segment, it choose a designated port, minor cost(in case that same cost in both switches, it choose the lower identifier “MAC address”), to transmit frames to root. In that designated switch, port which connect with segment is the designated port and the one who gives a minor cost path to the root is the root port.

There are three types of BPDUs:

  • Configuration BPDU (CBPDU), used for Spanning Tree computation
  • Topology Change Notification (TCN) BPDU, used to announce changes in the network topology
  • Topology Change Notification Acknowledgment (TCA)

BPDU´s are exchanged every 2 seconds that is useful for the other ones in case that a link is broken.

When you connect a device to a switch or bridge port it will go through a number of  states while determine the topology of the network.

STP states:

  • Blocking. Does not forward any frames but still receives BPDU’s from other switches
  • Listening. The switch processes BPDUs and awaits possible new information that would cause it to return to the blocking state.
  • Learning.  State in the transition to frame forwarding. Switch receives MAC address information from devices on this switch port.
  • Forwarding. Transmits and receives frames(usual state port).
  • Disabled. Not strictly part of STP, a network administrator can manually disable a port.