Defining the Spanning Tree Protocol – STP
The 802.1D Spanning Tree Protocol

The 802.1D Spanning Tree Protocol (STP) provides a mechanism for switches to reconfigure the paths over which they forward frames. This will provide a loop-free path when there are redundant switch paths through the network. This is accomplished by forwarding traffic over specific ports and by disabling other ports to avoid frames from being sent repeatedly or in a loop. STP prevents loops using the following mechanisms:

  • STP is implemented through the exchange of BPDU messages between adjacent switches.
  • A single "root bridge" is elected to serve as the reference point from which a loop free topology is built for all switches exchanging BPDUs.
  • Each switch determines a "root port" that provides the best path to the root bridge.
  • On a link between two non-root switch ports, a port on one switch will become a designated port and the port on the other switch will be in a blocking state, not forwarding frames. This effectively breaks any loop. Typically, the designated port will be on the switch with the best path to the root bridge.
  • Any port state change on any switch is considered a network topology change (for example if a port goes up or down and the STP Algorithm must be run on all switches to adapt to the new topology).

Spanning Tree Communication
A Bridge Protocol Data Unit (BPDU) is the unit of information sent by the Spanning Tree Protocol between switches to establish and maintain a loop free Layer 2 topology over optimal network paths. The information provided in a BPDU includes the following:

  • Root ID – The lowest BID in the topology
  • Cost of Path – Cost of all links from the transmitting switch to the root bridge
  • Bridge ID – (BID) of the transmitting switch
  • Port ID – Transmitting switch port ID
  • STP timer values – Max_Age, Hello Time, Forward Delay

The switch compares the BPDUs received on all ports to its own values to determine what role the receiving switch and its ports will play in the STP topology.