Watch on Instagram

Network Bytes · Episode 108 · CCNA 2.5

"Root Guard"

In spanning tree, the switch with the lowest bridge ID becomes the root. Root Guard goes on ports where the root should never appear; if a better root claim arrives there, the switch blocks the port instead of following it, and the port recovers by itself once the claims stop.

Posted · About a 1 minute watch, 4 minute read · Take the quiz

Why the root matters

In spanning tree, every switch has a bridge ID: its priority plus its MAC address. The switch with the lowest bridge ID becomes the root bridge, the center of the whole tree. Every other switch works out its best path toward the root, and spanning tree blocks the extra links so there are no loops. Network designers usually pick a strong core or distribution switch as the root on purpose, by giving it a low priority.

When a new switch takes over

Now someone plugs in a switch with a lower priority than the root, maybe a test switch from a lab or a small switch under a desk. It starts sending BPDUs that say "I'm root", and because its bridge ID is lower, those claims are superior BPDUs. The other switches believe them: the whole tree reconverges around the new switch. Traffic may now cross slow links or pass through a switch that was never meant to be in the middle of the network, and the change itself causes a short interruption.

What Root Guard does

Root Guard is enabled per interface with the command spanning-tree guard root. You put it on ports where the root should never appear, normally the designated ports on a distribution switch that face access switches or other networks.

If a superior BPDU arrives on a Root Guard port, the switch does not follow it. Instead it puts that port into the root-inconsistent state, which blocks traffic on the port much like a listening port. The rest of the tree carries on as before: the real root stays the root.

Recovering by itself

Root Guard does not need a manual reset. As soon as the superior BPDUs stop arriving on that port (for example, someone fixes the priority on the new switch or unplugs it), the port leaves the root-inconsistent state and goes back to normal forwarding automatically. This is different from BPDU Guard, which puts a port into the err-disabled state that usually needs an administrator to bring it back.

Try it yourself

In Cisco Packet Tracer, build a small triangle of three switches and make one of them the root with spanning-tree vlan 1 root primary. Add a fourth switch below one of the others, and on the port facing it type spanning-tree guard root. Now go to the fourth switch and give it a very low priority with spanning-tree vlan 1 priority 0. Back on the protected switch, run show spanning-tree and watch that port show as blocked and root-inconsistent (on real switches, show spanning-tree inconsistentports lists it too). Finally set the fourth switch back to its default with no spanning-tree vlan 1 priority 0 and check again: the port recovers by itself.

Good to know

  • CCNA 2.5 covers Rapid PVST+ concepts. Root Guard is one of the optional spanning-tree protection features alongside PortFast and BPDU Guard (EP32 covers loops, EP33 the root bridge election, EP88 PortFast and BPDU Guard, EP99 port roles).
  • The root bridge is the switch with the lowest bridge ID, which is priority plus MAC address. A "better root claim" is a superior BPDU, one that advertises a lower root bridge ID.
  • Root Guard is enabled per interface with spanning-tree guard root, normally on designated ports facing access switches or other networks that should never contain the root.
  • On a superior BPDU, the port goes into the root-inconsistent state, which blocks traffic like a listening port. It recovers automatically once superior BPDUs stop arriving, with no manual reset (unlike BPDU Guard's err-disabled state).
  • "Traffic reroutes through it" is simplified in the video: a new root forces the whole tree to reconverge, which can send traffic over slow links or through an unwanted switch.
  • Bridge priority can only be set in multiples of 4,096 (0 to 61,440), and the default is 32,768. PVST+ adds the VLAN number to the priority, which the video leaves out.

For CCNA learners

CCNA exam topic 2.5 asks you to interpret Rapid PVST+ concepts. Know that Root Guard keeps the root where you designed it: on a superior BPDU the port goes root-inconsistent (blocked) and recovers by itself, while BPDU Guard shuts a PortFast port down (err-disabled) when any BPDU arrives.

Answer to the comment question

28,672. Bridge priorities can only be set in steps of 4,096, so the next lower priority below 32,768 is 32,768 − 4,096 = 28,672. A switch set to 28,672 would beat a switch left at the default 32,768 in the root election, whatever their MAC addresses.

Test your knowledge

Quick quiz: "Root Guard"

4 multiple-choice questions. Pick one answer for each, then check how you did.

1Which switch becomes the spanning-tree root bridge?
2Where do you normally turn on Root Guard?
3A superior BPDU arrives on a Root Guard port. What happens?
4How does a root-inconsistent port get back to normal?

Sources

Video transcript

What stops a new switch from taking over as the root bridge?

In spanning tree, the switch with the lowest bridge ID becomes the root, the center of the whole tree.

Now someone plugs in a switch with a lower priority. It claims to be root, and traffic reroutes through it.

Root Guard stops that. You turn it on for ports where the root should never appear.

If a better root claim arrives on that port, the switch blocks the port instead of following it. The real root stays the root.

When the claims stop, the port recovers by itself.

A root has priority 32,768. Priorities step by 4,096. What's the next lower priority? Comment your answer below!

That's your byte.

More from Network Bytes

All Network Bytes lessons