## STP Puzzle #1, Answer Part 2

This post looks again at STP Puzzle #1. As usual, check out the original post to make sense of this one. Part 1 of the answer determined that switch S4 is the root in this puzzle. This post walks through the decision points on which ports are and are not root ports on the non-root switches.

And as usual, note that this kind of exercise might be nice for later-stage learning, but it’s not the best way to learn STP from the beginning. To learn the foundational material, check out a course or book, including my ICND2 book for that.

## Step 2: Find the Root Port for Each non-Root Switch

Once the root is known (S4 in this case), find the root port (RP) of each non-root switch. The root port is the one port on each switch through which that switch has the least-cost path to reach the root. Translated: if you examine all the paths form a switch to the root, and add the per-VLAN STP cost for every outgoing interface in that path, that is the cost for that path. Pick the switch interface that’s part of the lowest cost path. If there’s a tie, pick the path with the lowest neighbor Bridge ID (BID). If that’s a tie, parallel links exist to the same switch, so choose the lowest internal port number per the neigbhbor’s numbering. (But this problem avoids the tiebreakers.)

The problem statement tells us that switch S3 has an RP of F0/1, so we just need to analyze switches S1 and S2.

#### Analysis: S1’s Root Port

Starting with S1, use Figure 3 again (repeated from last post) that shows simply a letter for each interface’s STP cost, or the letter and a numeric value if the STP cost was given by the problem statement.

Figure 3: STP Costs: Letters and Letter=Values for STP Puzzle 01

In this topology, S1 has three possible paths between itself and root (S4). However, we can rule out S1’s F0/3 port, because it is impossible for both ends of a link between switches to both be RPs in the same STP topology. That is, in the same VLAN discussed for this problem, S3’s F0/1 is its RP, so S1’s F0/3, on the other end of the link, cannot also be an RP. The two remaining paths to root (S4) are:

1)     S1 F0/4 – S4

2)     S1 F0/2 – S2 F0/4 – S4

The cost to reach the root is the sum of all the outgoing port costs in those paths. Adding those up, you see the following:

1)     B = 8

2)     C + F = 8 + F

Clearly the first path will be better. The STP cost of an interface must be at least 1, so the second of the two paths will have a higher cost. S1 chooses its F0/4 port as its RP.

#### Analysis: S2’s Root Port

Following the same kind of logic on S2, S2 has three paths to the root. In this case, none of S2’s three links have a known RP on the other end of the link, so we cannot rule out any of S2’s three ports as potential RPs. Considering all three paths:

1)     S2 F0/4 – S4

2)     S2 F0/1 – S1 F0/4 – S4

3)     S2 F0/3 – S3 F0/1 – S1 F0/4 – S4

Adding up the costs through each path does not tell us the literal cost in each case, but it does give us some equations for comparison, as follows:

1)     F

2)     D + B = 4 + 8 = 12

3)     E + G + B = E + 19 + 8 = 27 + E

Clearly, path 2 is better than path 3. However, we just don’t know enough information to know if path 1 or path 2 is best. If S2’s F0/4 were configured for STP cost 11, for instance, S2 would choose path 1, using its F0/4 ports as RP. However, if configured as cost 13, S2 would choose path 2, using its F0/1 port as RP.

#### Aside: You Cannot Just Pick Any Cost for S2’s F0/4

Note that this is the first of what may be several STP puzzle exercises, and the format has a few challenges. These puzzles purposefully require a little more abstract thinking than a typical exam multichoice question. However, it does create some weird possibilities, which means you have to backtrack and double check. The analysis on switch S2 gives us a good example of just such a case.

For instance, with S2, if cost F is < 12, S2 picks its F0/4 port as RP. So you might be tempted to think about a test case with F=1. However, that value would not work given the original problem statement. Remember S3, with its F0/1 as RP? If S2’s F0/4 had a cost of 1, S3’s best path to the root would be out S3’s F0/2 port (cost 19) and then out S2’s F0/4 port (cost 1).

So, in this case, thinking about S2’s F0/4 port costs:

• Costs 1-8:  impossible, because these values result in S3’s RP being F0/2, and the problem statement tells us S3’s RP is F0/1.
• Cost 9-11: Valid values. These make S2 pick its F0/4 as RP, using lowest cost to decide
• Cost 12:    Valid value. It makes S2 pick its F0/4 as RP, using the least-BID neighbor tiebreaker to decide
• Cost > 13: Valid values. These make S2 pick its F0/1 as RP, using lowest cost to decide

#### Final Answer on RP Choices

Figure 4 details the Root and each Root Port on the remaining switches.

Figure 4: Root and Root Port Information, STP Puzzle #1

Subscribe
Notify of

Inline Feedbacks

[…] to make sense of this one. Note that answer part 1 looked at the reasons why S4 becomes root, and answer part 2 looked at how to determine which ports each non-root switch uses as their root ports […]

I’m confused on this one as I didn’t see anywhere mentioned in the Puzzle #1 that explicitly stated S3 F0/1 is it’s root port. I’m going based on the fact we didn’t know what switch picked which ports as root and picked S4 as root based on you setting its priority lower than default. When doing this my root port for S3 ended up being F0/2.

Nevermind, I didn’t catch in the config examples you wrote the root port. All I saw was that it was using all default costs.

No worries…

Hello Wendell,

In determining the RPs, I used the logic that if S4 is the RS with it’s F0/1 & F0/2 ports as DP. Invariably S1’s F0/4 & S2’s F0/4 ports will be their RPs. My reason for such logic is that both switches cannot be blocking on those ports since the switch on the other end is the RS. Is that a flawed logic? Can a switch be blocking on a port connected to the RS?

Hi Tewa,
That’s a great question, but yes, it’s flawed logic. While unlikely in production networks, S1’s root port choice is based on the various root cost calculations. The interface costs can be configured, so it’s possible to configure those costs so even directly-connected links, like in this case, do not become the root port. EG, imagine if S1’s ports were all configured with STP cost 200. The root cost through the other path(s), with default costs on those ports, would be lower.
Wendell

Thank you Wendell for the clarification, I appreciate your time & patience. This blog post has been a tremendous help, please do not stop. Continue as long as you are able to support those of us newbies seeking to break into networking field.

7
0