Use it to predict which ports will block, to explain why a particular port is the root port, and to change the outcome deliberately.
STP Root & Port Election Deep Reference
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.
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.
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
Operational reference
Fast context before you go deeper.
show spanning-tree vlan 10Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
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-priorityhad 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 · 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.
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:
| Speed | Cost (short, default) | Cost (long) |
|---|---|---|
| 10 Mb/s | 100 | 2,000,000 |
| 100 Mb/s | 19 | 200,000 |
| 1 Gb/s | 4 | 20,000 |
| 10 Gb/s | 2 | 2,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:
| Step | Root bridge | Root port (per switch) | Designated port (per segment) |
|---|---|---|---|
| 1 | Root bridge ID | Root path cost | Root path cost |
| 2 | — | Sender (designated) bridge ID | Sender bridge ID |
| 3 | — | Sender port ID | Sender 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.
| Port | Root path cost | Sender bridge | Result |
|---|---|---|---|
| Te1/1/1 | 2 | DIST1 (root) | Root port |
| Te1/1/2 | 4 (via DIST2) | DIST2 | Alternate |
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
| Lever | Changes |
|---|---|
| Bridge priority | Which 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.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
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%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.
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.
Operational notes
Former standalone Cheat Sheet content now lives directly inside the Topic where it belongs.