STP is defined in the IEEE 802.1D standard. In order to maintain a loop-free logical topology, every two seconds, switches pass Bridge Protocol Data Units (BPDUs). BPDUs are data messages used within a spanning tree topology to pass information about ports, addresses, priorities, and costs. The BPDUs are tagged with the VLAN ID.
Figure 31.1 below shows how loops can be created in a network. Because each switch learns about VLAN 20, it also advertises to other switches that it can reach VLAN 20. Soon enough, each switch thinks it is the source for VLAN 20 traffic and a loop is caused, so any frame destined for VLAN 20 is passed from switch to switch.
Figure 31.1 – How Loops Are Created
STP runs an algorithm to decide which switch ports stay open, or active, as far as a particular VLAN is concerned, and which ones need to be shut for that particular VLAN.
All switches that reside in the Spanning Tree domain communicate and exchange messages using BPDUs. STP uses the exchange of BPDUs to determine the network topology, which is determined by the following three variables:
- The unique MAC address (switch identifier) that is associated with each switch
- The path cost to the Root Bridge associated with each switch port
- The port identifier (MAC address of the port) associated with each switch port
BPDUs are sent every two seconds, which allows for rapid network loop detection and topology information exchanges. The two types of BPDUs are Configuration BPDUs and Topology Change Notification BPDUs; only Configuration BPDUs will be covered here.
