Open In App

Working of Spanning Tree Protocol (STP)

Spanning Tree Protocol (STP) prevents the looping of the frame by putting the interfaces of the switch in either forwarding or blocking state. How Switch is able to decide which interface should be in forwarding or blocking state. We’ll learn the answer to this question in this article. Before we further proceed, we must know some terms.

Note – We use the word “Bridge” although switches are involved because STP was introduced before switches. Bridges were the first device to use STP. Hence, various terms include the word “Bridge”. 



In Order to choose an interface for forwarding and blocking states, STP uses three criteria:

Characterization of ports STP states
All ports of the root switch Forwarding state
Root port of the non-root switch Forwarding state
Designated ports Forwarding state
All other working ports Blocking state

Electing Root Switch : 

All switches in a LAN exchange Hello BPDU with each other. Firstly all switches consider themselves root switches but the root switch is selected based on the BID of a switch. A switch having a lower priority bit in BID is a selected root switch. If the priority bit gets tied, then the switch has a lower MAC address in Hello BPDU is the selected root switch. In the diagram shown below, SW1 becomes the Root switch after comparing BID from each switch in LAN



 

Choosing Root port on Non-root Switches : 

The ports in each switch having minimum path cost to the root switch are chosen as the root port for that switch. In the diagram shown below, the Gi0/1 port of both SW2 and SW3 is chosen as the Root port (RP). 

 

Article Tags :