Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

STP Root & Port Election Deep Reference

Direct answer

Spanning tree runs three elections: one root bridge, one root port on every other switch, one designated port on every link. Each compares the same values in the same order — lowest wins — and a port that wins none is blocked.

When to use this

Use it to predict which ports will block, to explain why a particular port is the root port, and to change the outcome deliberately.

First 30 seconds

1. show spanning-tree vlan <id> — who is root, and with what priority?

2. Compare this switch's root path cost on each candidate port.

3. Equal cost → the neighbour's bridge ID decides, then its port ID.

4. Wrong root → spanning-tree vlan <id> root primary on the intended switch.

5. Wrong root port → adjust spanning-tree vlan <id> cost on the port.

Operational verification

bridge priorities set on root and backup root → lowest bridge ID becomes root → each switch: lowest root path cost → tie: neighbour bridge ID → tie: neighbour port ID → one designated port per link → the rest blocked

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Cisco IOS / IOS XE
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformCisco IOS / IOS XE
Key commandshow spanning-tree vlan 10
Scope / prerequisiteUse it to predict which ports will block, to explain why a particular port is the root port, and to change the outcome …
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational verification Verify boundary
show spanning-tree vlan 10
show spanning-tree root
show spanning-tree vlan 10 detail

The first prints the root's ID and this switch's own bridge ID, says "This bridge is the root" where that is the case, and names the root port and its cost. Below, each port is listed with role (Root, Desg, Altn), state, cost and port ID. show spanning-tree root gives the root, cost and root port for all VLANs in one table. The detail view shows, for every port, the designated bridge and port it hears from — the values used in the tie-breaks.

Known-good: the root is the intended switch in every VLAN, and each switch's root port is the intended uplink.

Step 2 Failure boundaries & interpretation Narrow the fault
  • An unexpected switch is root. All priorities are default and its MAC address is lowest; set priorities on the intended root and its backup.
  • The root differs between VLANs. The priority was set for some VLANs only.
  • A slower link is the root port. The total cost along it is lower, or costs were changed by hand somewhere.
  • port-priority had no effect. It was set on the downstream switch; the tie-break uses the upstream switch's value.
  • Costs differ by a factor of thousands between switches. Some use the long path-cost method and some the short one; use one method everywhere.
  • A new switch took over as root. It was configured with a lower priority, or Root Guard is missing where it attached.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Command lookup Jump straight to Cisco syntax
Key points

Root: lowest priority, then lowest MAC address. Root port: lowest path cost, then the neighbour's bridge ID, then the neighbour's port ID. To pick between two parallel links, port priority must be set on the switch nearer the root.

Key checks
  • show spanning-tree vlan <id> — root ID, own bridge ID, root port and cost, and each port's role, cost and port ID.
  • show spanning-tree root — the same summary for all VLANs.
  • show spanning-tree vlan <id> detail — the designated bridge and port heard on each port.
ReferenceWhat it is1 section · depth on demand

Mechanics & mental model

Spanning tree builds its tree in three elections: one root bridge for the network, one root port on every other switch, and one designated port on every link. Each election compares the same values in the same order, and the lowest value wins every time.

ReferenceWhy it matters1 section · depth on demand

Why it matters operationally

Which ports end up blocked is not arbitrary — it follows from priorities, link costs and, at the end, MAC addresses and port numbers. Knowing the order of comparison makes it possible to predict the topology, and to change it deliberately instead of by trial.

ReferenceHow it works1 section · depth on demand

How it works

1. Root bridge. The switch with the lowest bridge ID. The bridge ID is the priority followed by the switch's MAC address. The priority is 32768 by default, set in steps of 4096, and on Cisco switches the VLAN number is added to it — so VLAN 10 shows 32778. With equal priorities the lowest MAC address wins, which is often the oldest switch. Set it explicitly:

spanning-tree vlan 10 root primary
spanning-tree vlan 10 priority 4096

2. Root port — on each non-root switch, the port with the best path to the root. Compared in order:

1. Lowest root path cost.

2. Lowest bridge ID of the neighbouring switch.

3. Lowest port ID of the neighbour's port (its port priority, then port number).

4. Lowest local port ID.

The root path cost is the sum of the costs of the ports the BPDU was received on along the way:

SpeedCost (short, default)Cost (long)
10 Mb/s1002,000,000
100 Mb/s19200,000
1 Gb/s420,000
10 Gb/s22,000

3. Designated port — on each link, the port of the switch with the lower root path cost; if equal, the lower bridge ID. Every port on the root bridge is designated.

A port that is neither root nor designated is blocked.

To steer the result: spanning-tree vlan <id> cost <n> on a port changes which path this switch prefers. When two parallel links join the same pair of switches, the tie is broken by the upstream switch's port priority — so spanning-tree vlan <id> port-priority must be set on the switch nearer the root to influence the other one's choice.

ReferenceImportant terms & boundaries1 section · depth on demand

In depth

Root and port election: the comparison order in one place

The Catalyst 9300 STP guide states that the lowest bridge ID wins the root election (priority first, then MAC), and that port roles are root (best path to the root), designated (one per segment, forwarding), alternate (backup path to the root) and backup. Port priority defaults to 128 in steps of 16, and lower is preferred. Short-method path costs are 100, 19, 4, 2 and 1 for 10 Mb/s up to 25/40 Gb/s.

Priority vector comparison

Every election uses the same ordered comparison of BPDU information. Lowest wins at each step:

StepRoot bridgeRoot port (per switch)Designated port (per segment)
1Root bridge IDRoot path costRoot path cost
2—Sender (designated) bridge IDSender bridge ID
3—Sender port IDSender port ID
4—Local port ID—

Worked example

ACC1 has two uplinks: Te1/1/1 to DIST1 and Te1/1/2 to DIST2. DIST1 is root.

PortRoot path costSender bridgeResult
Te1/1/12DIST1 (root)Root port
Te1/1/24 (via DIST2)DIST2Alternate

On the DIST1–DIST2 link, DIST1 (cost 0) is designated, and DIST2's port is its root port.

C9300-ACC1# show spanning-tree vlan 20 | begin Interface
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- ------------
Te1/1/1             Root FWD 2         128.49   P2p
Te1/1/2             Altn BLK 2         128.50   P2p
C9300-ACC1# show spanning-tree vlan 20 detail | include from|designated

Practical consequences

LeverChanges
Bridge priorityWhich switch is root
Port cost (downstream switch)Which uplink is root port
Port priority (upstream switch)Which of several parallel links to the same switch is chosen

Verification habit

After any change, compare the root ID on all switches (show spanning-tree root) and the blocked ports (show spanning-tree blockedports) with the design.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docCisco IOS / IOS XE Current documentation reviewed 2026-09-14

Authoritative/upstream documentation reviewed for bounded claims in Network & Protocols → STP Root & Port Election Deep Reference. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.cisco.com/c/en/us/support/ios-nx-os-software/ios-xe-17/series.html · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
stp electionroot bridge electionstp tie breakerroot port selectiondesignated port selection
Embedded quick reference

Operational notes

Former standalone Cheat Sheet content now lives directly inside the Topic where it belongs.

STP Election Tie-Breakers — Fast Check

Explain why one port/root won

1. Lowest bridge ID = root.

2. Non-root: lowest root path cost.

3. Then upstream sender bridge ID.

4. Then sender port ID / local port tie-breaks as applicable.

5. Verify per VLAN/instance.

6. Read actual BPDU-derived values.

Confirmation

Confirm action

Continue?