×

gildings in this subreddit have paid for 7.71 hours of server time

Spanning-tree root path selection and Chris Bryant UDEMY series error by SuddenWeatherReport in ccnp

[–]newworldmonkeys2 2 points3 points  (0 children)

the process of choosing a root port first starts with the bridge ID, then moves on to the port with the lowest cost. This is clearly wrong.

It does start with BID, actually.

(Apologies in advance for the length, but I find that examples help, especially when it comes to STP. I've provided a tl;dr toward the end.)

In many lessons/texts/videos, the root bridge election and the local root port decision are shown as two separate processes. They tend to give the picture that first the root bridge election happens, and second each switch chooses its root port only after the bridge has been elected. In reality though, the two happen at the same time. The STP algorithm is such that the root bridge election and the root port decision are inseparable - they are just two results of one single decision, rather than two separate decisions that the switch has to make at different points in time.

Here's the topology:

SW1---SW3---SW2

The switches have just booted up, so STP is not yet converged (assume they all start the STP process at exactly the same time). MACs correlate to switch number, so SW1's MAC is 1111.1111.1111 and so on. Link speeds are all equal. Bridge priorities and link costs are defaults. We'll use VLAN1 for the sake of simplicity, so default bridge priority is 32769.

When the switches first come up, all three switches flood their own BPDUs and claim themselves as root. This means that SW3 will see a BPDU coming from SW1, where SW1 claims the root has BID 32769:1111.1111.1111. SW3 also sees a BPDU coming from SW2, where SW2 claims that the root has BID 32769:2222.2222.2222.

We know that SW3 will view SW1 as the root, because the BID of SW1 is lower than that of any other switch in the topology. But the point here is that SW3 also chooses its own root port at the same time as it recognizes a new root bridge. It sees the BPDU with root BID 32769:1111.1111.1111 which is lower than any other BID it has seen on any other port, so it knows "32769:1111.1111.1111 is the root bridge" - but it also knows "my best path to the root bridge is this interface". The first step of the root port decision is indeed a question of BID - SW3 has chosen its root port without considering root path cost whatsoever.

The root path cost tie-breaker only comes into play if there is a tie in root BID between BDPUs received on different ports. This is the more common scenario. If there is even one redundant link in the topology, then there will be at least one switch that sees BPDUs with tied root BIDs.

    SW3
   /   \
  /     \
SW1-----SW2

Assume the same parameters as earlier, with a couple minor differences. The SW1-SW3 link has a cost of 19. The other links have costs of 4 each.

As soon as the switches come up, they send BPDUs claiming themselves as root. SW1's BPDU and SW2's BPDU will have reached SW3 at the same time. SW3 receives both BPDUs and now views SW1 as root, because BID 32769:1111.1111.1111 is the lowest BID that it has seen. Thus SW3 also knows that its root port is its link to SW1, because the root BID seen on that port is lower than the root BID seen on its other port.

Shortly after those initial BDPUs though, SW2 will send a new BPDU to SW3 - this time SW2 claims that 32769:1111.1111.1111 is the root instead of claiming 32769:2222.2222.2222 as root like it did before. SW3 sees two BPDUs on separate interfaces, both BPDUs claiming that the root is BID 32769:1111.1111.1111. Because the root BID field in the BPDU is now a tie, we move on to the next factor. This is where SW2 will finally consider total path cost.

On SW3's direct link to SW1 the root path cost is 19. On SW3's link to SW2 the root path cost is 8. And so SW3 will now choose its link to SW2 as its root port.

~~~

It's not often that we have to consider root BID as a tie-breaking factor in the root port decision, because the root BID is very quickly propagated throughout the STP topology, and thus it very quickly becomes a tie throughout the entire layer 2 network. This is why it's easy to mentally skip that root BID tie-breaker and just go straight toward path cost. But if you consider initial convergence as above, it should be clear that root BID truly is the first tie-breaker when a switch is deciding on which port it should consider as its root port.

tl;dr - If SW3 sees root BID 32769:1111.1111.1111 off of its f0/1 port and it sees root BID 32769:2222.2222.2222 off of its f0/2 port, then SW3 most definitely chooses f0/1 as its root port, regardless of path cost. This situation just does not occur often - only during convergence (or in a misconfigured/poorly-designed network).

~~~

Again, apologies for the lengthy post. Hopefully this has been helpful though.