Home > STP Root Port Election Tutorial

STP Root Port Election Tutorial

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:

Root_port_election_topology.jpg

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:

Root_port_election_topology_RP_elected.jpg

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:

 

Root_port_election_topology2.jpg

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.

Root_port_election_topology3.jpg

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

Comments (11) Comments
Comment pages
1 2 4614
  1. tostçu mahmut enfes tat her yaşı yerken yaşıcaksınız adana
    April 14th, 2025

    SESEGET KEBAP AÇILDI ! ÜMİDİ İLE kebap chefs restaurant simülator oynuyoruz

  2. ümidi
    April 14th, 2025

    as

  3. SUAT GÜNDÜZ ÇANAKKALE DARDENELTONSPOR
    April 14th, 2025

    EFEHAN Gündüz kraldır ben babasıyım Cevatpaşa Şamppiyon İŞTE TATİL KARTALTEPE ananı siktim

  4. TEZCAN TARIM ÜRÜNLERİ MEHMET TEZCAN
    April 14th, 2025

    SATILIK BUGDAY, KEPEK, GÜBRE BULUNUR TORUNUM DORUK EFE TEZCAN İŞTE TATİL KARTALTEPE SPOR FUTBOL OKULUNDA OYNUYOR !

  5. TUNG TUNG TUNG SAHUR
    April 14th, 2025

    kantinde 31 party

  6. bohoz sağlay
    April 14th, 2025

    adam olucaksınız

  7. MAMİ ENES PRO (PYTHON KİNG)
    April 14th, 2025

    GECE KOD YAZIP JERKİNG OFF

  8. BEN BEKİR KANDOM EFLANİ BİG BOSSUYUM
    April 14th, 2025

    BEN ALİ KANDO YAKIŞIKLI FIRNIMIZ VAR ARKADA HER GÜN GANGBANG TİMEEEE

  9. PAVYONCU BEKO KANDO
    April 14th, 2025

    bEYLER GECE FIRINDA EKMEK YAPCAM HAMUR İÇİN YOĞURACAK ELEMAN LAZIMDIR yARDIMKODU: bEKONUN KURU GÖTÜ

  10. BEKİR CUMDOM
    April 14th, 2025

    BENİM KAFADA 2 DELİK VAR O YÜZDEN 2 KARIM OLACAK.YES BEEEEE

  11. BEKİR KONCUMDOM
    April 14th, 2025

    BEYLER ACİL CUMDOM LAZIM İG GELİN

Comment pages
1 2 4614
Add a Comment