For questions about Spanning Tree Protocol (STP), originally defined by IEEE 802.1D, to prevent bridge loops at OSI layer-2.
The Spanning Tree Protocol (STP) is a network protocol that builds a logical loop-free topology for bridged OSI layer-2 networks. The basic function of STP is to prevent bridge loops and the broadcast radiation that results from them. Spanning tree also allows a network design to include spare (redundant) links to provide automatic backup paths if an active link fails. This is done without the danger of bridge loops, or the need for manual enabling or disabling of these backup links.