Spanning tree protocol (STP) is a feature in managed switches that is designed to detect network loops and block redundant paths. The simple explanation of the protocol is that it calculates a cost function for each path through the network and then only allows the least-cost path to operate, discarding all incoming traffic on higher cost paths. Should the least-cost path fail (e.g. a physical cable gets disconnected), the algorithm immediately falls back to the next least-cost path. This is shown in Figure 3.
The STP algorithm allows a priority number to be set for each switch in the network (and even each port on a switch), where a smaller priority number indicates a lower cost for that switch so that a desired path can be established. For the algorithm to work, one switch must have the lowest cost, and this switch is designated the “root bridge.” In most network topologies, the root bridge should be the switch in the MDF connected directly to the LAN port of the router. If the priorities are not specified (i.e. all switches are left on their default priority values of 32768), the STP algorithm will automatically designate the switch on the network with the smallest numerical MAC address as the root bridge.
This is not an issue for aggregated links, as the switch is aggregating the multiple physical links into a single virtual trunk port, and thus only sees one connection.
Figure 3: Generic image of spanning tree blocking a loop in the network.