What is spanning Tree Protocol (STP)?
The companies and organisations are connected through networking. There should be a proper networking architecture for redundancy. Redundancy means providing multiple paths to keep the flow of data without traffic. All switches use Spanning Tree Protocol.
Spanning Tree Protocol is a layer two protocol used to prevent loops created when exchanging data on Local Area Networks (LAN), which contain redundant paths. This technique ensures that there is only one logical path between all the destinations on the network by blocking the redundant paths that might cause a loop. This also allows the inclusion of backup links by fault tolerance.
Spanning trees choose the optimum paths using an algorithm to look for redundant LAN links. It is primarily used to switch all links to forwarding or blocking modes. Following this procedure, it’s likely that all links without redundant links will be in the forwarding state. Links that were redundant but less effective than those chosen will be blocked. With Spanning Tree, there is no load-sharing feature.
How does this work?
Before designing the STP, the network topology should be planned and completed. For this configuration, the STP should be enabled with the same STP version for all the switches in the LAN.
What is a Root bridge?
The root bridge is the coordinate point for all the switches in a Spanning Tree topology. A selection procedure occurs when every controller is linked, choosing the bridge with the lowest bridge ID as the root bridge.
What is a root port?
A single port with the lowest travel cost to the root bridge is known as the root port. For root users, access is limited to ports from 1 to 1023. Therefore, we must assign those ports with root access. The range of ports utilised for user server applications is 1024 to 49151.
What is a designated port?
The port that can have the lowest path cost on LAN which is used to reach the root bridge.
Figure 1: https://www.orbit-computer-solutions.com/spanning-tree-protocol-stp/
The Spanning Tree Protocols can identify the links in the network and shut down the redundant networks, preventing loops. A root bridge is selected when the networks exchange the BPDU (Bridge Protocol Data Unit) messages. According to the root bridge chosen, every switch determines the port to which it will communicate with the root port.
BDPU message – a data message transmitted through LANs to detect the loops in the network topologies.
If more than one link gets connected to the root bridge, then a forwarding port(a designated port) is elected while the others are blocked.
- The MAC Address and the Priority value should select a root bridge. The switch with the lowest MAC address is chosen as the root bridge.
- Then the root port is selected.
- Then each switch needs to identify a single root port close to the routing bridge. This should be in the forwarding state.
- If two different switches belong to the same segment, they must be blocked to avoid loops. The switch with the higher MAC Address value and its designated port needs to be stopped.
Figure 2: https://www.pluralsight.com/blog/it-ops/switching-and-stp
Port states of STP
There are five port states, but they are switched only to one of the ports to control frame forwarding.
- Disabled – does not allow any frame forwarding or STP operations. The network administrator manually disables the switch port.
- Blocking does not allow frame forwarding and discards the frames received from the network. But the network listens and processes the BPDU messages.
- Listening – Moves from the blocking state; the port rejects the frames attached to the network segment. This receives the BPDU messages and redirects them to the switch for processing.
- Learning – The listening state port is changed to the learning state. It listens to the processed BPDUs and rejects the frames from the attached network segments. Then it updates the address table.
- Forwarding – the learning state transits to the forwarding state and starts forwarding frames throughout the network segments. It consists of the structures attached to the network segment and those delivered from another port. The port receives and processes the BPDU messages and updates the table.
Modes of STP
STP is based on algorithm new modes were created with the recent introduction of the convergence behaviours and the bridge port roles by the IEEE. Rapid STP, Multiple STP, Per-VLAN STP, and Rapid Per-VLAN STP(rapid PVST) are commonly used Spanning Tree Protocols.
The network should enter the required mode to enable an STP on a bridge or switch.
Spanning-tree mode <protocol mode>
e.g., Spanning-tree mode rstp
enables the Real Time Streaming Protocol on the switch.
Advantages of using STP
- It helps in link redundancy by preventing unwanted loops.
- Support the bridges and the switches
- The algorithms of STP ensure clarity in building a root bridge that has traffics and ensures the efficiency of data forwarding.
- Easy to design and maintain
- This allows the information to flow safely between the devices by avoiding the loops.
- It creates a pathway to limit the number of open paths and arrange them accordingly.
- It provides backups when the connection gets into any technical issue.
- If one path is not functioning correctly, the STP closes that path and opens another way.
- It works with 802.1D 1998 bridges.
- The CPU and memory requirements are less required.
Disadvantages of using STP
- You are limited to a single instance on any physical interface.
- STP is slower than RSTP because STP is timer based.
- It is not recommended for multiple VLANs because it limits the number of forwarding paths.
- If the topology changes, it does not provide a fast network confluence.
- Edge ports are not suitable when IEEE 802.1D STP is configured.
- Total network capacity may not be identified when using STP.
Alternatives to STP
The main two options are;
- Transparent Interconnection of Lots of Links(TRILL)
- Shortest Path Bridging (SPB)
TRILL uses layer three network routing techniques which create clouds and link them to internet protocol nodes as single IP subnets
SPB combines with MPLS(Multiprotocol Label Switching) and is backward compatible with STP.