5

So, I understand how STP convergence works on high-level. However, when I am trying to look into the process deeper, I run across some doubts I would appreciate someone could clarify to me.

Here we go:

I understand the election of the root bridge happens with the help of BPDUs being exchanged between each switch, with each switch first assuming it is the root bridge. So the switch with the lowest Bridge ID (Priority + VLAN ID + MAC address) will become the root. I also understand there's no mechanism in STP for one given switch to confirm other switches in the fabric agreed on the same Root Bridge. In other words, for each switch X there's no way to check that the neighboring switch Y elected the same root switch Z as the switch X did.

Question: How does each given switch decide when to stop the Root Bridge election and move on to next phase (Root port selection)? Or there's no such thing as "election stop" and this is rather continuous process? If this process is continuous, does it also mean that each switch starts the root port selection each time it receives a better BPDU? For example: SW1 with MAC "f" received better BPDU from SW2 with MAC "e" (thus SW1 considers SW2 a root bridge now) and right away starts election of the root port to SW2, but in the next split second SW1 receives even better BPDU from SW3 with MAC "a" and now starts electing the root port for SW3 and it continues to happen until SW1 doesn't receive better BPDUs anymore, so it's configuration stabilizes.

6
  • 1
    The root bridge election is not a specific election where each votes and then the votes are tabulated. Each bridge sends BPDUs out each interface, claiming to be the root until it receives a superior BPDU on an interface, then it stops claiming to be the root on that interface. It will quickly shake out which interfaces are toward the roo, and which are not.
    – Ron Maupin
    Dec 24, 2021 at 15:55
  • Question for resources are explicitly off-topic here, but it might be useful to look at the authorative source IEEE 802.1Q-2018 which you can get here free after registration.
    – Zac67
    Dec 24, 2021 at 16:21
  • @just_a_noobie ask your other questions in separate questions, although i am not quite sure why question 2 needs to be separated
    – Effie
    Dec 28, 2021 at 11:32
  • @Effie you probably seeing the old version of the question. I already edited that one, leaving only one question currently. Otherwise, not sure what do you mean by question 2? Dec 28, 2021 at 12:40
  • yes, i was looking at the edit history. i mean if you still have those two questions unanswered you can ask them in a separate question.
    – Effie
    Dec 28, 2021 at 13:06

2 Answers 2

5

It is a continuous process. It is continuous because the root bridge (or any other bridge) can fail. If root fails, new root needs to be selected, and if anyone else fails, affected part of the tree need to be recomputed again.

In order to prevent cycles in the topology, while the tree converges, there is a separate mechanisms to switch ports from non forwarding to forwarding states, which more or less works like "wait 30 secs, in 30sec the tree will definitely converge so it the port is still in forwarding state it is safe to turn forwarding on".

If you are thinking in a "termination" in a way it is defined in distributed algorithms[*], there is no such termination. Root (and everyone else) thinks it is a root unless it hears of a better root (which may happen if a better root is added to the topology later, or if some other switches' priority is changed).

How does each given switch decide when to stop the Root Bridge election and move on to next phase (Root port selection)?

no, from the point of the protocol there is only one phase, in which each bridge processes received PDU and acts accordingly.

the bridge considers all BPDUs on each LAN (including its own) and decides who is the root bridge, who is designated bridge for each LAN it is attached to, and where is his root port. Then it decides whether messages need to be sent out.

Or there's no such thing as "election stop" and this is rather continuous process? If this process is continuous, does it also mean that each switch starts the root port selection each time it receives a better BPDU?

The above happens every time a new BPDU is received. The protocol is executed exactly the same on each PDU. Again, this is necessary because the protocol needs to deal with bridge/switch failures.

For example: SW1 with MAC "f" received better BPDU from SW2 with MAC "e" (thus SW1 considers SW2 a root bridge now) and right away starts election of the root port to SW2, but in the next split second SW1 receives even better BPDU from SW3 with MAC "a" and now starts electing the root port for SW3 and it continues to happen until SW1 doesn't receive better BPDUs anymore, so it's configuration stabilizes.

Basically yes.

Note 1: there is a minimal intra-BDPU interval, so SW1 cannot send new messages out faster than one per second (please check the standard for this value)

Note 2: Root election is made based on bridge ids. A bridge id is a combination of <prio, MAC address>, where MAC is one of the MAC addresses. Prio is set to some default value (one half of its max value if I am not mistaken) in the standard, and can be set to something else. This allows network operator to configure, which bridge will be selected root (but the protocol will still work if noone touches anything).

Note 3: the root, i.e., the bridge that haven't heard of a better bridge id than its own, continues to create new BPDUs every N seconds (also known as periodic or hello BPDUs). These as kind of keep-alives, telling everyone that root bridge has not failed. These BPDUs are also processed exactly the same as others. In a stable state they will result in every bridge sending copies of root BPDU on all designated ports thus informing every other bridge/switch that the tree has not changed.

[*] see e.g., ch 15.2 in Nancy Lynch's Book

1
  • @Zac67 thanks :)
    – Effie
    Dec 28, 2021 at 11:59
4

The "election" is really a conceptual idea. Each bridge starts out sending its own bridge ID as the root bridge. If it hears a better ID, it starts sending that one. When all bridges are sending the same root ID, we say the network has "converged", but bridges aren't aware this has happened. The root port is simply the port which receives the best cost to the root.

The root port and/or root ID could be changed with every BPDU received.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.