root guard
termKept in this browser · My desk
A spanning tree port setting that keeps a port from ever becoming the path to the root: if a better root claim arrives on it, the port is blocked instead of the tree moving.
Cisco places such a port in the root-inconsistent (blocked) state; Juniper's root protection moves it to a root-prevented state and returns it to forwarding automatically when the superior BPDUs stop; the IEEE 802.1Q model calls the control restrictedRole, under which the port becomes an Alternate Port rather than a Root Port; the Linux bridge calls it root port guard. It is disabled by default on Cisco's Catalyst 9300.
What it is. Root guard is a spanning tree port setting that keeps a port from ever becoming the path to the root bridge: if a better root claim arrives on it, the port is blocked instead of the tree moving. It is configured on ports that face places the administrator does not control, so that the root, and with it the shape of every forwarding path, stays where it was designed to be.
Why it exists. The spanning tree root is whoever announces the lowest bridge identifier, and nothing in a BPDU (bridge protocol data unit) is authenticated; Phrack's 2003 analysis of STP (Spanning Tree Protocol) attacks starts from that absence of authentication, and Juniper's documentation names the threat as a bridge application on a PC that interferes with root port election. Cisco's 2002 tests, presented by Sean Convery at Black Hat USA, showed a root claim drawing traffic through the claimant and reducing a gigabit backbone to 10 Mb half duplex; the attacker had to be dual-homed to two switches, or to one through a hub. The Yersinia framework (2005) put STP attacks in a menu. Setting the root's priority decides among your own switches; root guard on downlinks to places you do not control is what stops a stranger.
The identifier, field by field. In the IEEE (Institute of Electrical and Electronics Engineers) 802.1Q model the bridge priority is a 4-bit value from 0 to 15, default 8, and lower values indicate the better identifier; it is followed by a 12-bit system identifier extension (0 to 4095, the VLAN or instance on per-VLAN implementations) and the bridge's 48-bit MAC (media access control) address. The priority therefore moves in steps of 4,096, and the default 8 appears as 32768, 0x8000, which is exactly what Phrack's 2003 capture prints: root 8000.00:50:e2:bd:58:40. A worked comparison: the designed root sends 1000.00-00-5E-00-53-01 (priority 4096); a PC on an access port starts sending BPDUs claiming root 0000.00-00-5E-00-53-66 (priority 0). Zero is lower, so the claim is superior, and without protection every switch would recompute the tree around the PC. With root guard on that access port the switch blocks the port for as long as the superior BPDUs keep arriving, and the rest of the tree never hears about them.
On each platform. Cisco places such a port in the root-inconsistent (blocked) state, and root guard is disabled by default on the Catalyst 9300. Juniper's root protection moves it to a root-prevented state, blocks it only for the spanning tree instances on which superior BPDUs arrive, returns it through listening and learning to forwarding automatically when they stop, and cannot be combined with loop protection on the same interface. Fortinet's FortiSwitchOS has the port ignore or drop superior BPDUs, so that it never becomes the path to root, and says to enable it on all ports that should not lead to the root bridge but never on the root port, with STP enabled. The IEEE model calls the control restrictedRole: the port becomes an Alternate Port rather than a Root Port, even with the best priority vector, at the risk of a lack of spanning tree connectivity. The Linux bridge calls it root port guard (IFLA_BRPORT_PROTECT), meant for ports facing a hostile guest.
Where to put it. Cisco's 2008 campus design guide recommends root guard or BPDU guard on every access port, BPDU guard only where someone can re-enable disabled ports, since root guard recovers by itself. In practice that means access ports and any downlink towards equipment outside the administrator's control, never the ports that lead towards the designed root.
What goes wrong. Root guard on a port that leads to the real root blocks the legitimate path, which is the loss of connectivity the IEEE text warns about; after a redesign that moves the root, the old guards must move too. It protects the root's position, not the network from every BPDU: an inferior claim passes, a stream of topology change notifications still flushes tables (the IEEE's restricted-tcn setting handles that), and a loop through the guarded port is still a loop. One divergence in the record: Cisco's 2008 guide describes root guard as reacting to inferior BPDUs, while Cisco's own 17.12 guide, Juniper, Fortinet and the IEEE model describe the trigger as a superior root claim, which is the behaviour described here.
Neighbours. BPDU guard shuts a host port on any BPDU; BPDU filtering hides BPDUs and can create loops; loop guard keeps a blocked port blocked when BPDUs stop; topology change notification is the flush root guard does not stop. Also spanning tree, STP and RSTP (Rapid Spanning Tree Protocol).
Also known as: root guard, root protection, restricted role, root port guard, root-inconsistent
Sources
- Cisco, Layer 2 Configuration Guide, IOS XE 17.12.x (Catalyst 9300), Configuring Optional Spanning-Tree Features, 28 July 2023, read through WebFetch (read 2026-11-23): BPDU guard error-disables; BPDU filtering is the same as disabling spanning tree and can cause loops, disabled by default; root guard places the interface in the root-inconsistent (blocked) state, disabled by default
- Juniper Networks, Understanding Root Protection for STP, RSTP, and MSTP (read 2026-11-23): a user bridge application on a PC can interfere with root port election; superior BPDUs move the port to a root-prevented (inconsistency) state; recovery to forwarding is automatic when they stop
- IEEE 802.1, ieee802-dot1q-rstp YANG module, revision 2025-02-04 (read 2026-11-23): bridge priority 0 to 15, default 8, lower is better; restricted-role prevents selection as Root Port; restricted-tcn prevents propagation of topology changes and address flushing; max age default 20 s, forward delay default 15 s
- The Linux kernel documentation, Ethernet bridging (read 2026-11-23): IFLA_BR_FDB_MAX_LEARNED; IFLA_BRPORT_GUARD disables a port that receives a BPDU; IFLA_BRPORT_PROTECT, root port guard, against a hostile guest rerouting traffic; the disabled state, also called BPDU filter
- Cisco, Campus Network for High Availability Design Guide, Cisco Validated Design, 21 May 2008, PDF bytes saved by WebFetch (read 2026-11-23): enable root guard or BPDU guard on access ports; disable trunking on host ports; trunks on with no negotiation; native VLAN on an unused ID or tagged; double 802.1Q encapsulation is one-way and needs the native VLAN ID
- Sean Convery (Cisco Systems), Hacking Layer 2: Fun with Ethernet Switches, Black Hat USA 2002 (read 2026-11-23): Cisco and @stake tests; macof since May 1999 (Ian Vitek, Perl; C port by Dug Song); 155,000 entries a minute filled a 131,052-entry Catalyst 6506 table in 70 seconds; existing entries keep forwarding; port security and its modes; STP root claims, the dual-homed requirement, a gigabit backbone reduced to 10 Mb half duplex; BPDU guard and root guard; DTP switch spoofing and double 802.1Q encapsulation, one-way, needs the trunk's native VLAN; port security does not help against ARP spoofing
- Oleg K. Artemjev and Vladislav V. Myasnyankin, Fun with the Spanning Tree Protocol, Phrack 61, 13 August 2003 (read 2026-11-23): STP has no authentication; the configuration BPDU field by field; a tcpdump capture with max age 20, hello 2 and forward delay 15 and its hex bytes; endless reconfiguration as denial of service
- Fortinet, FortiSwitchOS 7.2.2 Administration Guide, MSTP configuration (read 2026-11-23): STP and edge port enabled on all ports by default; edge ports go straight to forwarding; STP loop protection off by default and recommended on all nondesignated ports; root guard on ports that should not lead to the root, never on the root port; BPDU guard needs an edge port, with a port timeout of up to 120 minutes, 5 by default, reset with execute bpdu-guard reset; Flood BPDU Packets passes STP packets through only when MSTP is disabled, otherwise they are blocked
- Fortinet, FortiSwitch 7.6.0 FortiLink Guide, Configuring STP settings (read 2026-11-23): root guard keeps the interface from becoming the path to root, superior BPDUs received on it being ignored or dropped; BPDU guard on edge ports takes the port down for a set number of minutes (up to 120, 5 by default) and the BPDUs are not forwarded; status with diagnose switch-controller switch-info bpdu-guard-status
- yersinia(8), Debian bookworm manual page (read 2026-11-23): a framework for layer 2 attacks covering STP, VTP, HSRP, DTP, IEEE 802.1Q, IEEE 802.1X, CDP, DHCP, ISL and MPLS