Defining the Spanning Tree Protocol – STP
Preventing loops in a layer 2 network

A loop free network is one in which no Layer 2 loops exist, therefore the network cannot create layer 2 broadcast storms or flooded unicast storms. A loop free network can be achieved manually by shutting down or disconnecting all redundant links between bridges. However, this leaves no redundancy in the network and requires manual intervention in the event of a link failure.

STP resolves this problem. Where there are alternate links to a destination on a switch, only one link will be used to forward data unless there is a failure on that link. The switch ports associated with alternate paths remain aware of the topology of the network and can be enabled if a failure occurs on primary link. In the case of primary link failure, the switch will begin forwarding frames over an alternate link.

The spanning-tree algorithm (STA) runs on each switch to activate or block redundant links. To find the redundant links, the STA chooses a reference point in the network and determines if there are redundant paths to that reference point. If the STA finds a redundant path, it chooses which path will forward frames and which redundant path or paths will be blocked. This effectively severs the redundant links within the network until they are needed when the primary link toward the reference point fails.

Spanning tree standards often refers to a "bridge" but it is likely that all the devices exchanging spanning tree information will be Layer 2 switches.