Switching

STP Root Bridge Election

STP elects one root bridge per VLAN: the switch with the lowest bridge ID wins. Bridge ID = priority (default 32768, plus the VLAN number) + MAC address — so with default priorities, the oldest switch's lowest MAC wins, which is rarely what you want. Always set the root deliberately.

The election, step by step

  1. Every switch boots believing it is root and advertises its bridge ID in BPDUs.
  2. Switches compare received BPDUs: lowest priority wins; on a tie, lowest MAC address wins.
  3. Convergence ends with exactly one root per VLAN; everyone else calculates their best path to it.

Because default priority is 32768 everywhere, elections default to the MAC tiebreak — often an ancient access switch. Force the right result:

spanning-tree vlan 10 priority 4096      # deliberate value
spanning-tree vlan 10 root primary       # or let IOS pick one

Root ports and designated ports

After the root exists, every non-root switch picks one root port — its best path toward the root — by comparing, in order: lowest path cost to root → lowest sender bridge ID → lowest sender port ID. Each segment then gets one designated port (the segment's best path to root); every remaining port blocks, and that blocking is what kills the loop. Full protocol context: Spanning Tree explained.

Design rules that follow

  • Make your distribution/core switch the root (and a second one root secondary) — never leave it to MAC luck. In a three-tier design, the root belongs at distribution.
  • Protect the election: PortFast + BPDU Guard on access ports (lab) and root guard toward areas that must never take over.
  • Verify with show spanning-tree — it names the root and this switch's role per VLAN (command guide).

Frequently asked questions

How is the STP root bridge elected?

The switch with the lowest bridge ID wins. Bridge ID is the priority (default 32768 plus VLAN number) followed by the MAC address, so on default priorities the lowest MAC — often the oldest switch — becomes root.

How do I force a switch to be the root bridge?

Lower its priority: spanning-tree vlan X priority 4096, or use spanning-tree vlan X root primary. Set a second switch as root secondary for failover.

What is the difference between a root port and a designated port?

A root port is a non-root switch's best path toward the root (one per switch). A designated port is a segment's best path toward the root (one per segment). All remaining ports block to break loops.

What breaks ties when path costs are equal?

In order: lowest sender bridge ID, then lowest sender port ID. The comparison sequence is cost → sender BID → sender port ID.

VS
Vipul Sir — Lead Instructor, Attila Technologies20+ years in Cisco networking. Teaching CCNA, CCNP, CCIE & CyberOps in Ahmedabad since 2004.

Want hands-on training?

Learn this on real Cisco lab devices with placement support at Attila Technologies, Ahmedabad.

Start your networking career with Attila Technologies

Hands-on Cisco training, real lab devices and placement support in Ahmedabad.