STP is the short form for Spanning Tree Protocol & RSTP (Rapid Spanning Tree Protocol), MSTP (Multiple Spanning Tree Protocol) are all advanced/ improved implementations of STP. In this article, we will try to understand the basic concepts of Spanning Tree Protocols and their implementation.
What is Spanning Tree Protocol (STP) and why is it required?
Spanning Tree Protocol, and its improved versions, are required mainly for two reasons – To prevent network loops (due to multiple paths to the same destination) & to introduce redundancy in the link connections (if one link fails, the data is still routed through a different link/route).
Network loops sometimes happen inadvertently, especially in large networks. When there are two or more paths to the same destination, there is a danger of broadcast packets getting in to an infinite loop and hence causing congestion in the network. So, STP is used to identify the best path to the destination, and block all other paths (links). The blocked links are not always discarded. They are connected and kept inactive by STP, so that, when the best path fails – the next best path can be achieved by activating the blocked links.
Consider the above diagram. For the moment, let us concentrate on the Switch A, B & C. Switch C is connected to Switch A & Switch B via direct links. But there is another link (marked in red) that goes from Switch A to Switch B. If no Spanning Tree Protocol is applied in this scenario, there would be looping of data and hence broadcast congestion in the network.
But if STP enabled switches are employed, the link L3 is effectively blocked from transmitting any data. Its very much connected to the Switches A & B and keeps listening to the network. If either L1 or L2 links fail, this link (L3) automatically gets activated. This provides for both link redundancy and switch redundancy in the network.
Similarly, Switches C, D, E, F & G can also provide link redundancy if they are connected as shown in the above diagram & STP/RSTP enabled switches are employed.
Electing the Root:
Electing the Root bridge/ Root Switch is one important process in Spanning Tree Protocol. It is with reference to the Root Switch that all the other switches determine their best cost path. The Root Switch is the Central reference Switch. In our above diagram, Switch C could be considered as the Root bridge as it is in the central location.
Generally, the root switch is elected by selecting the switch with the lowest bridge ID. Its possible (and recommended) to manually select the root switch. If it is not selected manually, the switches will themselves elect a root switch. If the root switch fails, all the other switches repeat the election process and select a new root switch, from the available switches. The other switches in the network are called designated switches.
There is a certain cost assigned to every link. For example, higher bandwidth (1000 Mbps) links that are directly connected/ close to the root are assigned a lower cost (and) lower bandwidth (10 Mbps) links that are multiple hops away from the root are assigned a higher cost. Once link costs are estimated, STP/RSTP determines the lowest cost connections from each designated switch to the root switch to determine the path with the lowest cost. It also blocks all the other higher cost links to avoid looping in the network.
BPDU stands for Bridge Protocol Data Units. BPDU, are messages (in a certain format) that are exchanged between the switches that participate in the STP/ RSTP process. The switches pass BPDU messages between them continuously (after every two seconds, for example) to exchange their understanding of the network topology / routes/ link costs, etc. They establish the best path (least cost) connections to the root switch with the help of BPDU messages obtained from other switches.
Whenever there is a change in the network parameters (link/switch down, new link/new switch added, etc), it is detected and topology-change BPDU is sent to all the switches / switch ports by the root switch. The designated switches then adjust their filtering/ forwarding tables with this information to determine the new location/ routes to the end stations (computers).
RSTP – Rapid Spanning Tree Protocol:
The above processes are common to STP/RSTP & MSTP. With STP, the detection and reconfiguration of network topology changes (when a cable is cut/ new switch is added) takes some time – like 30-50 seconds. Since, a lot of critical / time sensitive applications are running on the LAN, this inactive period may not be acceptable. So, Rapid Spanning Tree Protocol (RSTP) was conceived to overcome this problem (RSTP takes 5-6 seconds to update and re-configure the new network topology/ routes).
In RSTP, link status of each port are monitored pro-actively (instead of waiting for the BPDU messages) to detect network topology changes. RSTP is backward compatible with STP switches.
The Switch ports that participate in RSTP have three states – Discarding (Does not accept/ forward any data but listens to BPDU messages), Learning (Once the network topology change is detected/ activation request comes via the BPDU message and filtering/ forwarding table creation is initiated) & Forwarding (RTSP ports start accepting and forwarding data packets/ frames).
MSTP – Multiple Spanning Tree Protocol:
MSTP (Multiple Spanning Tree Protocol) can map a group of VLAN’s into a single Multiple Spanning Tree instance (MSTI). Which means, the Spanning Tree Protocol is applied separately for a set of VLAN’s instead of the whole network. Different root switches and different STP parameters can be individually configured for each MSTI. So, one link can be active for one MSTI and the other link active for the second MSTI. This enables some degree of load-balancing and generally two MSTI’s are used in the network for easier implementation.
You could stay up to date on the various computer networking/ related IT technologies by subscribing to this blog with your email address in the sidebar box that says, ‘Get email updates when new articles are published’