Spanning Tree Protocol or STP is a standard IEEE protocol 802.1d that is used on a switched network wherein multiple links and devices are connected to prevent loops. It places certain ports in a blocking state making it certain to have a path for each network segment but when a link is down it makes a blocked port to forward state thus making another path and making a redundant path active.
The Major advantages of STP is to prevent Broadcast storms which floods a switch endlessly, Multiple Frame transmissions which is sent to a destination making unrecoverable errors, and MAC Address Instability that make copies of Media Access Control that is received on different ports.
STP election is based on the switch, if is configured as primary which automatically makes it as a root bridge. When it is not configured as the primary the Bridge ID or BID plus the MAC address will be the basis. If the BID are all the same or default on a switched network the switch will base on the lowest MAC address.
STP exchange configuration every two (2) seconds using Bridge Protocol Data Unit or BPDU, a multicast frame that provides information for other switches to receive during a link is down, election process, and normal operations. Switches calculate the least cost path using the bandwidth cost of each link required to reach the root bridge on a switched network the Root Bridge usually have the Designated port’s which are incoming traffic from another switch and doesn’t connect to the least cost path. The Root port’s connects to the root bridge and provides the least cost path or switches that are connected with the Root Bridge switch and Blocked port’s are port’s that does not forward traffic.
These are Ethernet Speed with the corresponding revised IEEE Cost or bandwidth cost:
10 Mbps – 100
100 Mbps – 19
1 Gbps – 4
10 Gbps – 2
There are three (3) port states: Blocking when loss of BPDU is detected and twenty (20 seconds maximum ageing time), Listening this is were it listen to BPDU’s from other switches to decide if it will block or to become a root or designated port; forward delay for fifteen (15) seconds, Learning learns the STP tree and forwards delay for fifteen (15) seconds, Forwarding forwards data, and Disable when the port is administratively down.
Lastly, STP cannot provide fast convergence on nowadays network and will took a maximum of fifty (50) seconds but there are protocols available for fast up links such as the Rapid Spanning Tree Protocol or RSTP.