Understanding Spanning Tree Protocols – STP, RSTP, MSTP

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.

Spanning Tree Protocol Example DiagramConsider 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.

Link Costs:

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 Messages:

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.

excITingIP.com

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’

27 thoughts on “Understanding Spanning Tree Protocols – STP, RSTP, MSTP

  1. Shamim

    hi ,

    I felt its a very good site for network engineers to keep up the knowlege about networking technologies.

    Thanks to EXITINGIP.com :))

    Thanks,
    Shamim

  2. Anonymous

    really useful

  3. Milind

    Its very easy to understand.

    Thanks

  4. mustafa ph

    very good to refer

    Thanks

  5. Indhu

    Very useful to recollect the STP concepts. Thanks

  6. Mukund

    nice explaination, really help us for understand in easiest way…

  7. rajesh singh

    Every answer has good example and explained very well

  8. vamsi

    hi

    can we configure both stp and rstp ?
    if 1 swpth am running stp and another switch am running mstp can we both can we it will work
    for clean understanding of mstp please tell me website

    thank you
    vamsi

  9. kannan.t

    Very good explanation .. Thank you very much ….

  10. Ramana

    Excellent explanation..thank u ,but i need MSTP also completely can u explain otherwise send the documento to my e-mail…

  11. rehan

    excellent mate.. is there any video lectures of him related to ccna?

  12. Nixay patel
    Nixay patel says:

    elaborate and easy to understand explaination

  13. Kiran

    Excellent explanation to new learners in most easiest way and more importantly simple language.

  14. Timi Oweifie

    Nice piece, very detailed and educative

  15. sesha

    good one

    1. Anonymous

      good,I understanded

  16. avinash

    yes…good explanation ….and good teaching…switch…
    thank….u

  17. nikhil

    i think some more info is needed give some brief instead of reading this i preffer Wikipedia no IEEE standard mentioned lolz

  18. swapnil

    really simple expaination

  19. Prakash Giri
    Prakash Giri says:

    perfect explanation.

  20. Bigger

    Thank a lot. You save my day.

  21. Santosh B

    Dear Rajesh, as usual a very nice article. I am trying to find a simple explanation for PVST and some illustrations to help me understand how a STP is maintained per VLAN but not able to find help online. Can you help?

  22. Ahmed

    The information provided above is verymuch usefull

  23. Anonymous

    Very helpful information
    Thanks

  24. rajesh

    Very helpful information
    Thanks

  25. Ali Ibrahim

    It is tough to stay organized when knowing there is STP, RSTP, and MST along with PVST and RPVST. Could someone shed some light on the differences between PVST and RPVST?

Comments are closed.