STP – Detailed Explanation of STP Convergence Process

ciscoieee-802.1wloopspanning treeswitch

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.

Best Answer

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

Related Topic