To provide for fault tolerance, many networks implement redundant paths between devices using multiple switches. However, providing redundant paths between segments causes packets to be passed between the redundant paths endlessly. This condition is known as a bridging loop.
To prevent bridging loops, the IEEE 802.1d committee defined a standard called the spanning tree algorithm (STA), or spanning tree protocol (STP). With this protocol, one bridge (or switch) for each route is assigned as the designated bridge. Only the designated bridge can forward packets. Redundant bridges (and switches) are assigned as backups.
The spanning tree algorithm provides the following benefits:
- Eliminates bridging loops
- Provides redundant paths between devices
- Enables dynamic role configuration
- Recovers automatically from a topology change or device failure
- Identifies the optimal path between any two network devices
The spanning tree algorithm automatically discovers the network topology, and creates a single, optimum path through a network by assigning one of the following roles to each bridge or switch. The bridge role determines how the device functions in relation to other devices, and whether the device forwards traffic to other segments.
Devices send special packets called Bridge Protocol Data Units (BPDUs) out each port. BPDUs sent and received from other bridges are used to determine the bridge roles, verify that neighbor devices are still functioning, and recover from network topology changes. Devices participating in the spanning tree algorithm use the following process to configure themselves:
- At startup, switches send BPDUs (Bridge Protocol Data Units) out each port.
- Switches use information in the BPDUs to elect a root bridge.
- Switches on redundant paths are configured as either designated (active) or backup (inactive) switches.
- After configuration, switches periodically send BPDUs to ensure connectivity and discover topology changes.
As the switch participates in the configuration process, and while it operates, each of its ports is placed into one of five states. The port state determines whether the port receives and forwards normal network messages.
Note: When you use spanning tree on a switch with multiple VLANs, each VLAN runs a separate instance of the spanning tree protocol.