Home > STP Root Port Election Tutorial

STP Root Port Election Tutorial

September 21st, 2018 Go to comments

In this tutorial we will learn in detail how Spanning Tree Protocol (STP) elect root port after choosing a root bridge.

Root port is the port that is closest to the root bridge, which means it is the port that receiving the lowest-cost BPDU from the root. Every non-root bridge must have a root port. All root ports are placed in forwarding state.

Spanning Tree Root Port election process (notice that it is Root Port election, not Root Bridge election process) in a Non-Root Switch includes the following steps:
1. Lowest accumulated cost on interfaces towards Root Bridge
2. Lowest Sender Bridge ID
3. Lowest Sender Port ID (= Port Priority + Port Number) (so port priority is compared first then to Port number)

Let’s see an example below:


Note: In fact the MAC address should be something like “00:00:00:00:00:01” but we write “01” in short. Same for “02”, “03” and “04” MAC addresses.

According to the topology, SW1 has the lowest MAC address “01” (hence lowest bridge ID because of same default Bridge Priority 32768) so it will become the Root Bridge. Now we will see which port will become Root Port in each non-root bridge (SW2, SW3, SW4 and SW5).

Root Port election is based on the port having lowest accumulated cost to the Root Bridge SW1 (step 1 above). Here is how to calculate the path cost: SW1 (root bridge) sends BPDU with cost of 0 to other directly connected switches. When a switch receives this BPDU, it adds its own port cost to this value. For example, SW2 has two ways to reach SW1:

+ SW2 – SW1: path cost is 0 + 4 = 4
+ SW2 – SW4 – SW3 – SW1: path cost is 0 + 4 + 4 + 19 = 27

Note: The path cost is calculated as follows:

10 Mbps = 100
100 Mbps = 19
1 Gbps = 4
10 Gbps = 2

Therefore SW2 will choose the first path so the port that is directly connected to SW1 on SW2 will become root port.

Same on SW3, the port that is directly connected to SW1 will be chosen root port.

On SW4, there are two ways to reach SW1:

+ SW4 – SW2 – SW1: path cost is 0 + 4 + 19 = 23
+ SW4 – SW3 – SW1: path cost is 0 + 4 + 4 = 8

Therefore SW4 will choose the port connects to SW3 root port. Now all the root ports have been elected:


We found all the root ports on each switch with only step 1 in the three steps above so it is easy. In the next example we will change the topology a bit with all 1Gbps connections and add SW5 to make the election harder:



The root ports on SW2 and SW3 are unchanged. But on SW4 both path costs to SW1 are now equal so we need to use step 2 “Lowest Sender Bridge ID”. SW4 will compare BPDU sent from SW2 & SW3 and choose the lower Bridge ID.

In this case SW2 MAC address of 02 is smaller than SW3 MAC address of 03 (while the switch priorities are equal) so SW4 chooses the port connected to SW2 the root port.

How about SW5 root port? SW5 has two paths to reach SW1 but they have same path cost. Also both ports connected to SW4 so the Switch ID value is the same too. Therefore we have to use step 3: the lowest Sender Port ID wins. In this case SW4 has two ports fa0/1 and fa0/2 so fa0/1 wins and SW5 will choose the port connected to fa0/1 of SW4 the root port.


In this topology we have to use up to step 3 as the tie-breaker.

Comments (6) Comments
  1. makic
    September 11th, 2019

    this is not correct answer, 3rd tie breaker should be lower port priority and 4th internal port number. Correct this!

  2. 9tut
    September 12th, 2019

    @makic: It is the same:
    3. Lowest Sender Port ID (Port Priority + Port Number)
    so Port Priority is compared first then to Port number.
    We also updated our article to clearly explain it.

  3. maoca
    October 7th, 2019

    Kindly would anyone send me 200-125 test dumps to mariolopznet at hotmail.com? thank you in advance.

  4. irfan
    October 20th, 2019

    If any one have latest Dumps for ccna 200-125 please share with me. I have exam on 30th on this month. iak4614(at)outlook(dot)com

  5. dmitry
    October 24th, 2019

    Pls send me dumps 200-125, my mail dimon965316(dog)yandex(dot)ru

  6. Anonymous
    November 12th, 2019

    Last example has an error. States 100 Mbps and cost of 4 between SW2 and SW4. Probably just a typo.

Add a Comment