# Answer to an Earlier STP Question

This post answers the Spanning Tree question linked here. The short answer is that there are lots of right answers! What could impact the choice of root port in a triangle topology? All port costs except the root switch’s ports’ costs, and the port priority on the non-root switches as well. Details to follow!

Part of the point of this question is to get us to generically apply the concepts of how a switch chooses its root port. The question asked about how any non-root switches would think about how they choose their respective toot ports, and what facts might influence those choices. This explanation walks through an analysis that breaks down the topology into triangles, and shows why collectively all non-root switches’ STP costs matter, and why the same interfaces’ STP priorities matter.

## Default STP Costs

First, consider the re-drawn version of the subset of the topology with switches S1, S2, and S3, shown here as Figure 2. S1, the root per the original question, sits at the top of the figure, just to make the tree structure more intuitive. The figure shows the default FastEthernet cost of 19 on each interface. It also shows the flow of Hellos that reach switch S2 during the STP convergence process.

#### Figure 2: S1 as Root, S2 Calculates Competing Root Costs

You can choose to use an acronym like RACA to recall the steps a switch uses when thinking about Hello messages and choosing its root port. RACA would stand for in this case:

Choose the best hello; use that port as the root port

Advertise a Hello based on that choice out other ports

In this case, S2 receives the cost=0 Hello on F0/1, adds cost 19 (of S2’s F0/1), as one cost-to-reach-the-root to consider. S2 also receives a cost=19 Hello from S3; then S2 adds its F0/3 cost of 19, for a second option of cost 38. Clearly, the first of S2’s options has the lower cost; S2 chooses its F0/1 interface as Root Port.

So which of these ports’ interface costs impacted S2’s choice? Well, both of S2’s interfaces in the triangle  impacted one or the other calculation. Additionally, S3’s F0/1 interface cost impacted the cost S3 listed in the Hello it sent to S2. So all three interfaces’ costs impacted the choice.

Note that if the costs were reconfigured, S2 might have chosen its F0/3 interface as root port, e.g., if S3’s F0/1 were cost 10, and S2’s F0/3 were cost 8, then S2 would have chosen its F0/3 interface as its root port.

## Switch S3’s F0/2 Port Also Plays a Role

So far, the analysis does not show a case where S3’s F0/2 interface impacts any RP choice. However, if you take the same logic, and think about it from S3’s perspective, both of S3’s interface costs in the triangle impact the choice. Figure 3 shows just such a case. Note that some of the STP costs have been reconfigured just to make the math choices more obvious.

#### Figure 3: S1 as Root, S3 Calculates Competing Root Costs

In this case, S3 actually chooses the longer path to the root switch as the better path, making S3’s F0/2 interface S3’s root port.

## Lowest Sender’s Bridge ID as the Last Tiebreak in this Topology

If one switch receives multiple Hellos from the same root switch over different paths, plus the costs tie, the switch has to use a tiebreaker. The tiebreakers are, in order:

1. Choose based on the lowest bridge ID of the neighbor that sent the Hello
2. Choose based on the lowest port priority of the sender’s port (interface)
3. Choose based on the lowest internal interface number of the sender’s port (interface)

However, in this topology, with only a single link between each pair of switches, the first tiebreaker will always break the tie. For example, Figure 4 shows a tie on S2, with cost 19 through both paths to the root. In this case, S2 would examine both received Hellos: one that lists S1’s bridge ID as the forwarding switch of the Hello, and one that lists S3’s bridge ID as the forwarding switch of the Hello.

#### Figure 4: S1 as Root, S2’s Root Port Options Tie on Cost

Because of the topology, with three switches, one switch will be root, and the two non-root switches will receive up to two Hellos: one from each of the other switches. As a result, the neighboring switch’s Bridge ID, which is listed in the Hello, will be unique, so it will always allow the switch to choose based on the better (lower) bridge ID.

Because of that, I would consider the two answers that mention port priority to be incorrect in this case. The reasoning is that the question asked about this particular network, and with this topology, the first of the three tiebreakers will determine the root port, so the port priority, which is not considered until the 2nd tiebreaker, will never affect the outcome.

Whew. That was a lot! Ask clarifying questions if you have them.

Write a comment

1. Marcelo August 14, 16:11

Hi. Excellent explanations. I think almost the same way like you. I was thinking for myself that in the case of a tie, in this topology SW1 would always win, because it is the root because it has the lowest BID in the topology. So, I thought the other answers were right too (those about priorities), until I read your explanation. But I think, if a BID is the lowest, is logical to think that it has the lowest priority too, so I think that the order of the tiebreakers would be 1. lowest port priority, 2. lowest port BID (because if priorities tie, then you see the switch MAC address as a tiebreaker), 3. lowest internal interface number.

I’m a little confused about my point of view and yours, please clarify this a little more. Thanks a lot.

• certskills Author August 15, 16:47

Hi Marcelo,
Well, I think the list that I put in the post, which swaps #1 and #2 vs your list, is correct. I’m not quite understanding your logic as to why you believe your list is correct. In my list, #2 and #3 are important and used ONLY when you have parallel links between two switches. That is, tiebreak number 1 takes care of questions with equal-cost paths to the one root through two DIFFERENT neighboring switches, while #2 and #3 take care of the decision when the equal cost hellos arrive from the same ONE neighboring switch. Hope this helps.
Wendell

• Marcelo August 20, 20:57

Hi. Yes, it helped a lot. The reason of my confusion is that I was seeing the priority and the mac address as two separate things inside the BID, and not as one big number. Someone else had a similar way to see things like me, in the first question of this post https://blog.certskills.com/ccna/q213-answer/
But now I have a clearer idea. Thanks a lot.

## Write a comment

#### Subscribe

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.