Skip to content
Related Articles

Related Articles

Working of Spanning Tree Protocol (STP)

View Discussion
Improve Article
Save Article
  • Last Updated : 29 Jul, 2020

Spanning Tree Protocol (STP) prevent the looping of frame by putting the interfaces of 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 answer of this question in this article. Before we further proceed, we must know some terms.

  • BID –
    It stands for Bridge ID. It is an 8-byte value unique to each switch. First two bytes are priority bytes and remaining six bytes contain built-in MAC address of switch.

  • Path Cost –
    It is a numeric value given to link between two interfaces based on speed of the interface. Higher the link speed, lower will be the cost.

  • BPDU –
    Bridge protocol data unit is a message that switches exchange b/w them. Commonly used BPDU is Hello. It contains cost and BID.

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

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

  • Selection of root switch. All of its interfaces are in forwarding state.
  • All other non-root switches makes a root port. And root port is that port whose path cost to root switch is minimum. All root ports are placed in forwarding state.
  • Least path cost from each switch to root switch is called that switch’s root cost. And among all switches, switch whose root cost is minimum becomes designated switch. Port of designated switch from which root cost is calculated becomes designated port(DP). DP is placed in forwarding state.

S.noCharacterization of portsSTP states
1.All ports of root switchForwarding state
2.Root port of non-root switchForwarding state
3.Designated portsForwarding state
4.All other working portsBlocking state

Electing Root Switch :
All switches in a LAN exchange Hello BPDU with each other. Firstly all switch consider themselves as root switch but root switch is selected based on BID of switch. Switch having lower priority bit in BID is selected root switch.

If priority bit get tied, then switch having lower MAC-address in Hello BPDU is selected root switch. In diagram shown below, SW1 becomes Root switch after comparing BID from each switch in LAN.

Figure – Root switch election

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

Figure – Root port selection on Non-root switches

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!