Network devices that act as open systems interconnection (OSI) model layer two bridging devices, including switches, are often connected together redundantly to help prevent network failures. The spanning tree protocol (STP) is a set of rules, methods and communications functions that are implemented in bridge software and that prevent data link layer frames from endlessly looping within a redundant bridge topology. The spanning tree protocol is a data link layer protocol that establishes a singular, lowest-cost pathway for data to travel from any one bridged network endpoint to another.
Bridges that use the spanning tree protocol send special messages called bridge protocol data units (BPDUs) to each other in order to share information and notify each other about network changes. Most bridges participate in the spanning tree process, but network administrators might designate some bridges as pass-through-only devices. All of the bridging devices that actively use the spanning tree protocol exchange BPDUs in order to establish and maintain a loop-free, minimum spanning tree topology.
STP initiates recalculation of a new spanning tree topology whenever bridges are added to or removed from the network, when pathways fail within the network, when undirectional link detection (UDLD) detects a broken fiber or when other topological changes occur and disrupt the established flow of data. The bridges that actively use the spanning tree protocol begin topological reconfiguration by first agreeing upon and designating one of the bridging devices as a root node for the new spanning tree. They then collaborate by sending BPDUs to each other that contain current information and path costs in order to calculate a new spanning tree that has the lowest cost for the topology. As soon as the bridges agree on a new topology, bridge ports connected to redundant segments that are not a part of the new spanning tree and are not part of a designated etherchannel are temporarily blocked to prevent forwarding of data traffic. Blocking these unused redundant pathways creates a loop-free topology.
The spanning tree protocol was first developed and implemented by the Digital Equipment Corporation (DEC). It was shortly thereafter incorporated into the Institute of Electrical and Electronics Engineers(IEEE) 802.1D standard. A newer, faster version of the spanning tree protocol called the rapid spanning tree protocol (RSTP) was introduced by the IEEE 802.1w proposal. RSTP has superseded STP as the standard protocol for loop-free bridging and was designated as the protocol of choice in the revised IEEE 802.1D-2004 standard. STP has been refined even further with the release of the multiple spanning tree protocol (MSTP) as detailed in IEEE 802.1Q-2005, which allows separate instances of STP to coexist in multiple virtual local area network (VLAN) configurations.