The Spanning Tree Protocol (STP) resolves the problem of physical loops in a network by establishing one primary path between any two devices. Duplicate paths are barred from use and become standby or “blocked” paths until the primary path fails, at which point the redundant path can be brought into service.
STP operates by forming a fully connected tree of data loop free LAN connected bridges (switches) through the exchange of Bridge Protocol Data Units (BPDUs). Each bridge port transmits BPDUs on a periodic basis. The information contained in the BPDU is used by the receiving bridge to calculate a port role for each bridge port. There is one bridge in the network chosen to be the root bridge, based on its bridge ID. Ports that directly connect bridges to the root bridge or are connected through another bridge are assigned one of four roles:
For a summary of port roles, see Spanning Tree Port Roles.
While the network is in a steady state, alternate and backup ports are in blocking state; root and designated ports are in forwarding state.
STP allows for the automatic reconfiguration of the network. When bridges are added to or removed from the network, root election takes place and port roles are recalculated.