BPDU Guard vs Root Guard vs Loop Guard — When to Use Which (CCNA)
CCNA tutorial on Cisco STP protection: BPDU Guard, Root Guard, and Loop Guard. What each blocks, where to apply them, and the real outage each one prevents.
Spanning Tree does its job. Left alone, it picks a root bridge, calculates loop-free paths, and blocks the redundant links. But STP is trusting — it believes every BPDU it receives, from any port, at face value. That’s fine on a static topology and dangerous the moment humans (or hardware failures) enter the picture.
Cisco ships three protection features that make STP paranoid in the right ways: BPDU Guard, Root Guard, and Loop Guard. They sound similar. They solve different problems. Confusing them is how you either leave a hole open or slap a feature on the wrong port and cause the outage you were trying to prevent.
Prereq: this post assumes you already understand root bridge election. If STP itself is still fuzzy, start there.
The one-line idea
- BPDU Guard — “a wall jack should never receive a BPDU. If it does, err-disable the port.”
- Root Guard — “no switch reachable through THIS port is allowed to become root.”
- Loop Guard — “if a port that was blocking suddenly stops seeing BPDUs, don’t unblock it — the neighbor might be broken.”
Three features, three failure modes. Once you know which one attacks which failure mode, deployment is one line per port.
The setup — why STP alone isn’t enough
STP’s convergence math is bulletproof, but its inputs aren’t. Three things break it:
1. Someone plugs a switch into an access port. Maybe an employee bought a 5-port desk switch to add ports. Maybe an attacker plugged in a laptop running stpd. Either way, that new device sends BPDUs. If it advertises a lower Bridge ID than your core, STP will make it the root — for a network you don’t control. Users route traffic through the desk switch. Everything slows. Some things break.
2. A rogue switch gets connected to a distribution uplink. Maybe a legitimate switch, wrongly configured with priority 0. It becomes root. Every packet in the network now takes a suboptimal path through it. The blast radius scales with your topology.
3. A fiber pair loses one strand. The port stays up (the other strand still carries some signal). But BPDUs don’t arrive anymore. STP thinks its neighbor died and transitions the port from Blocking to Forwarding. Now two ports are forwarding on what used to be a loop — you get a bridging loop, MAC flapping, and a broadcast storm. Total layer-2 meltdown in under 60 seconds.
Each of the three protection features prevents one of these scenarios.
BPDU Guard — access-port protection
The rule: an access port (one that faces a user, a printer, a phone) has no legitimate reason to ever receive a BPDU. If one arrives, someone plugged a switch where they shouldn’t have.
What it does: the port goes into err-disabled state the instant a BPDU is received. No forwarding, no learning — down. Requires manual shutdown / no shutdown (or auto-recovery, more below) to bring back.
Where to apply: every access port. Typically enabled globally in combination with PortFast:
Switch(config)# spanning-tree portfast default
Switch(config)# spanning-tree portfast bpduguard default
That two-line global config says “any access port with PortFast enabled also has BPDU Guard enabled”. Since PortFast should be on every access port anyway (it skips the 30-second listening/learning delay for a user’s laptop that isn’t going to send BPDUs), pairing it with BPDU Guard is standard practice.
Per-port, if you prefer explicit:
Switch(config)# interface FastEthernet0/5
Switch(config-if)# switchport mode access
Switch(config-if)# spanning-tree portfast
Switch(config-if)# spanning-tree bpduguard enable
Recovery: when a port goes err-disable, syslog logs something like:
%SPANTREE-2-BLOCK_BPDUGUARD: Received BPDU on port Fa0/5 with BPDU Guard enabled.
%PM-4-ERR_DISABLE: bpduguard error detected on Fa0/5, putting Fa0/5 in err-disable state
Manual recovery:
Switch# configure terminal
Switch(config)# interface Fa0/5
Switch(config-if)# shutdown
Switch(config-if)# no shutdown
Or auto-recovery after 5 minutes (my recommendation for large sites so you don’t have to manually reset every port):
Switch(config)# errdisable recovery cause bpduguard
Switch(config)# errdisable recovery interval 300
The port comes back automatically. If the rogue switch is still there, it goes err-disable again 5 minutes later — you’ll see a repeating pattern in syslog that’s easy to hunt.
Root Guard — root-election protection
The rule: a specific port should never lead toward a switch that becomes root. If a superior BPDU (lower Bridge ID) arrives on this port, treat it as untrusted — put the port into root-inconsistent state.
Where BPDU Guard drops rogue devices at the access, Root Guard drops rogue devices at the distribution/core. Suppose you designed your network so CORE-1 is the intended root (priority 4096) and every other switch has default priority (32768). Now someone connects SW-BASEMENT with priority 0 to a distribution uplink. Priority 0 wins the election, CORE-1 gives up root, all your carefully-planned traffic patterns invert.
What it does: ports with Root Guard enabled block superior BPDUs. If one arrives, the port transitions to root-inconsistent (a special blocking state) until the offender stops. Then the port recovers automatically — no err-disable, no manual intervention.
Where to apply: on ports facing downward, away from the intended root. Never on the ports facing toward root — that’s where legitimate root BPDUs come from.
Switch(config)# interface GigabitEthernet1/0/24
Switch(config-if)# spanning-tree guard root
Verify + monitor:
Switch# show spanning-tree inconsistentports
Name Interface Inconsistency
-------------------- ---------------------- ------------------
VLAN0010 GigabitEthernet1/0/24 Root Inconsistent
If nothing shows, no port is currently blocking a rogue root — good. If something shows, the port name plus VLAN tells you exactly where to walk.
Loop Guard — unidirectional-link protection
The rule: if a port that was in Blocking state suddenly stops receiving BPDUs, do NOT transition it to Forwarding. Assume the neighbor is broken (silent, unidirectional, or misconfigured) and stay blocked.
What it does: puts affected ports into loop-inconsistent state instead of unblocking them. Auto-recovers the moment BPDUs start arriving again.
Why it matters: without Loop Guard, a fiber pair that loses one direction is a serious hazard. STP times out (no BPDUs = neighbor gone), unblocks the redundant port, and both paths now forward on what was a loop. Total meltdown in seconds.
With Loop Guard, that same silent-failure scenario produces one blocked port and a syslog message — not an outage.
Where to apply: on every trunk port between switches. Typically globally:
Switch(config)# spanning-tree loopguard default
Or per-interface if you want to be selective:
Switch(config)# interface GigabitEthernet1/0/1
Switch(config-if)# spanning-tree guard loop
Detection:
%SPANTREE-2-LOOPGUARD_BLOCK: Loop guard blocking port GigabitEthernet1/0/1 on VLAN0020.
The 3-line summary — which one, where, what it stops
| Feature | Where to apply | Triggers on | Result |
|---|---|---|---|
| BPDU Guard | Access ports (user-facing) | Any BPDU received | err-disable — manual (or auto) recovery |
| Root Guard | Ports facing away from root | Superior BPDU received | root-inconsistent — auto-recovers when the superior BPDU stops |
| Loop Guard | Trunk ports (switch-to-switch) | BPDUs stop being received on a blocking port | loop-inconsistent — auto-recovers when BPDUs return |
The single most useful mental frame: BPDU Guard reacts to unexpected BPDUs, Loop Guard reacts to missing BPDUs, Root Guard reacts to superior BPDUs. Presence, absence, or too-good — one for each.
Common mistakes
1. Enabling BPDU Guard on a trunk port. Trunks legitimately receive BPDUs from the switch on the other side. BPDU Guard err-disables it instantly and takes down the uplink. Trunks want Loop Guard, never BPDU Guard.
2. Enabling Root Guard on ports facing toward the root. Every legitimate root BPDU that arrives will trip the guard, blocking your uplink to root. Roots BPDUs come FROM root, so ports leading TO root are safe to trust — those are the wrong ports for Root Guard.
3. Enabling Loop Guard on a port to a non-STP device. If the neighbor doesn’t send BPDUs (an unmanaged switch, a hypervisor with STP disabled, a legacy device), Loop Guard reads “BPDU absent” and blocks the port permanently. The absence isn’t a failure — it’s normal for that neighbor. Solution: enable Loop Guard only on ports that face STP-speaking neighbors, or use per-interface config instead of default.
4. Skipping err-disable auto-recovery. Without errdisable recovery cause bpduguard, every accidentally-triggered BPDU Guard event requires a truck roll (or a remote SSH session that isn’t going to work if the trunk went down). Set the auto-recovery interval to 300 seconds and move on with your life.
The lab you should build
Two switches. One trunk between them. One access port on SW1 with a laptop. Configure:
SW1andSW2—spanning-tree loopguard defaultandspanning-tree portfast bpduguard defaultSW1 Fa0/5(laptop) —spanning-tree portfast(BPDU Guard inherits from default)SW2 Gi1/0/24(uplink toSW1) —spanning-tree guard root
Now break it three ways:
- Plug an old switch into
Fa0/5. WatchFa0/5go err-disable within a second. - Configure
SW1withspanning-tree vlan 1 priority 0. WatchSW2 Gi1/0/24goroot-inconsistentand the network keep the original root. - Kill one direction of the trunk (unplug just one fiber, or in Packet Tracer,
shutdownon one side without the other seeing it). Watch Loop Guard kick in.
Every real switching outage you ever fix in production traces back to one of these three failure modes.
Cheat strip
- BPDU Guard = “BPDUs are unexpected here” → access ports → err-disable
- Root Guard = “root shouldn’t be reachable through here” → downstream ports → root-inconsistent
- Loop Guard = “if BPDUs stop, don’t trust the port to unblock” → trunks → loop-inconsistent
- Always pair PortFast + BPDU Guard as a default on the access layer
- Auto-recover err-disable (300s) so single mistakes don’t need a human
The bigger point
STP protection features are what separate a switch configuration that survives real users from one that survives only the lab. Every US enterprise network you’ll ever work on has these enabled — and every outage caused by a rogue switch is a network engineer who forgot one of them. Learn which does what, deploy the right one on the right port, and you’ll never be the engineer who caused a Monday-morning outage because someone plugged in a home router.
For the full protocol treatment of STP itself, see Spanning Tree — root bridge election. For the hands-on lab, grab any of the STP Packet Tracer files.
Ready to build the network engineer instincts that get you hired?
Reading show spanning-tree inconsistentports output and immediately knowing which fix to apply — that’s the difference between a CCNA on paper and an engineer employers pay for.
At PacketMentor we build those instincts, one broken lab at a time. 👉 Book your free 20-minute 1:1 mentorship discovery call today.
Get posts like this by email.
One short, opinionated tutorial per week. Unsubscribe in one click.
Personal reply from a senior network engineer. No third-party tracking. Unsubscribe any time.
