In an 802.1D ring S1-S2-S3-S4-S1 of equal-cost links with S1 as root, which ports become root, designated and blocked?
answer
- three passes: root, designated, leftover
- the far switch ties on cost
- sender bridge ID breaks the tie
- the nearer bridge owns each link
basics
~20 sS2 and S4 use their S1-facing ports as root ports; S3, two hops either way, picks the neighbour with the lower bridge ID; each link's designated port sits on the bridge nearer the root, leaving one S3 port blocking.
solid answer
~50 sWork it in three passes under IEEE 802.1D's rules. **Root ports:** each non-root bridge adds its receiving port's path cost to the root path cost each neighbour advertises and keeps the lowest. With 1 Gb/s links at the IEEE long value of 20,000, S2 and S4 reach S1 at 20,000 through their S1-facing ports. S3 sees 40,000 both ways, so the next tie-breaker, the lower **sender bridge ID**, decides: if S2's is lower, S3's root port faces S2. **Designated ports:** on each link the bridge advertising the lower root path cost owns it — S1 on both of its links, S2 on S2–S3, and S4 on S3–S4, because S4's 20,000 beats S3's 40,000. **Blocked:** S3's port toward S4 is neither root nor designated, so it blocks — one blocked port for the one redundant link.
code
pseudocode · 17 lines# 802.1D root-port choice on a non-root bridge (lowest vector wins, compared left to right)
bestPort = none
bestVector = none
for port in bridge.ports where port has a received configuration BPDU:
vector = (bpdu.rootPathCost + port.pathCost,
bpdu.senderBridgeId,
bpdu.senderPortId,
port.portId)
if bestVector is none or vector < bestVector:
bestPort = port
bestVector = vector
rootPort = bestPort
# S3 in the equal-cost ring, long costs:
# via S2: (20000 + 20000, 32768/00-00-5E-00-53-02, ...) -> 40000
# via S4: (20000 + 20000, 32768/00-00-5E-00-53-04, ...) -> 40000
# cost ties, lower sender bridge ID wins -> the port facing S2go deeper
Recall that the root bridge's ports are designated and that exactly one port in a simple ring ends up blocked.
Walk the three passes aloud: root ports by cost and tie-breakers, designated ports per link, and the leftover port that blocks.
Predict how a cost or priority change moves the blocked port, and check the result against what the switches report before touching the network.
Use the computation to place the blocked link on purpose — on the slowest or least critical segment — rather than letting MAC addresses decide.
## The scenario Four bridges form a ring: S1–S2, S2–S3, S3–S4, S4–S1. Every link is 1 Gb/s, and every port uses the IEEE 802.1t **long** path cost of 20,000 for that speed. Bridge IDs are priority plus MAC address, using the documentation MAC range: | Bridge | Bridge ID (priority / MAC) | Role in the election | |---|---|---| | S1 | 32768 / 00-00-5E-00-53-01 | root (lowest bridge ID) | | S2 | 32768 / 00-00-5E-00-53-02 | non-root | | S3 | 32768 / 00-00-5E-00-53-03 | non-root | | S4 | 32768 / 00-00-5E-00-53-04 | non-root | The election is taken as given; what follows is what 802.1D does with ports once the root is known. ## Pass 1: root ports Each non-root bridge evaluates every port that hears configuration BPDUs and compares, in order, lowest first: 1. **Root path cost** through the port: the root path cost the neighbour advertises plus this port's own path cost. 2. **Sender bridge ID** — the bridge that sent the BPDU. 3. **Sender port ID** — that bridge's port priority and port number. 4. **Receiving port ID** — this bridge's own port. - **S2:** via S1 it receives cost 0, plus 20,000 = **20,000**. Via S3 the path runs around the ring and costs more. Root port: the S1-facing port. - **S4:** the same reasoning gives **20,000** through its S1-facing port. - **S3:** via S2, 20,000 + 20,000 = **40,000**; via S4, 20,000 + 20,000 = **40,000**. The costs tie, so step 2 decides: S2's bridge ID (…-02) is lower than S4's (…-04), so S3's root port faces **S2**. ## Pass 2: designated ports On every link, the port on the bridge advertising the lower root path cost is designated; ties would go to bridge ID, then port ID. | Link | Advertised root path costs | Designated port | |---|---|---| | S1–S2 | S1: 0, S2: 20,000 | S1's port | | S4–S1 | S1: 0, S4: 20,000 | S1's port | | S2–S3 | S2: 20,000, S3: 40,000 | S2's port | | S3–S4 | S3: 40,000, S4: 20,000 | S4's port | ## Pass 3: the leftover port blocks Eight inter-switch ports exist. Three are root ports (S2, S3, S4), four are designated (two on S1, one on S2, one on S4). The one left over is **S3's port toward S4**: it is neither root nor designated, so it sits in `blocking`. Traffic from S4 to S3 now travels S4 → S1 → S2 → S3. ## Change one link Make S2–S3 a 100 Mb/s link, long cost 200,000, with everything else unchanged: - S3 via S2: 20,000 + 200,000 = **220,000**. S3 via S4: 20,000 + 20,000 = **40,000**. S3's root port flips to face **S4**, with no tie to break. - On S2–S3, S2 still advertises 20,000 against S3's 40,000, so S2's port stays designated. - On S3–S4, S4 (20,000) is still designated. - The leftover is now **S3's port toward S2**: the slow link is the blocked one. The 802.1D-1998 **short** values give the same choices: 4 for 1 Gb/s and 19 for 100 Mb/s, so S3 compares 8 against 8 in the equal ring and 23 against 8 with the slow link. Here the tables agree, but not everywhere: their ratios differ (one 1 Gb/s hop costs as much as two 10 Gb/s hops in the short table, five times as much in the long one), and they diverge badly when bridges using each are mixed on one network. ## Common slips - Breaking S3's tie by its **own** port number: the receiving port ID is the last step, after the sender's bridge ID and port ID. - Putting the designated port on the bridge with the **higher** cost: the bridge nearer the root owns the link. - Expecting both equal-cost paths to carry traffic: 802.1D keeps one root port per bridge and blocks the rest. - Placing the blocked port on the root bridge: the root's ports are designated on ordinary links, so the block lands on the far side of the ring.
- In the same 802.1D ring, what changes if the S2–S3 link drops to 100 Mb/s?With long costs, S3 via S2 costs 20,000 + 200,000 = 220,000 and via S4 still 40,000, so S3's root port flips to face S4. On the S2–S3 link S2 still advertises 20,000 against S3's 40,000 and stays designated, so S3's port toward S2 is now the blocked one: the slow link carries no traffic.
- Does the result change if every bridge uses the 802.1D-1998 short cost values instead?No. In the short table 1 Gb/s costs 4 and 100 Mb/s costs 19, so S3 compares 8 with 8 in the equal ring and 23 with 8 with the slow link — the same choices. The tables can disagree on other topologies because their speed ratios differ, and they break badly when bridges using each are mixed, because root path costs are summed across bridges.
- When would S3's own port ID decide its root port?Only when root path cost, sender bridge ID and sender port ID all tie — two S3 ports hearing the same port of the same neighbour, as on a shared segment. In a ring with one link per neighbour the sender bridge ID always differs, so S3's port numbering never decides anything.
saying these in an interview costs you the question
- S3 breaks the cost tie by its own lowest port number.
- The bridge with the higher root path cost is designated on a link.
- The blocked port in a ring lands on the root bridge.
- Both equal-cost paths to the root forward and share the load.
- Root path cost adds the sending port's cost as well as the receiving port's.