Understanding Loop Guard in STP

May 27, 2025

Jeremy’s IT Lab - STP Toolkit: Loop Guard

Introduction

  • Topic: Loop Guard as an additional defense against Layer 2 loops in STP (Spanning Tree Protocol)
  • STP's main purpose is to prevent loops.
  • Previous features discussed: PortFast, BPDU Guard, BPDU Filter, and Root Guard.

What is Loop Guard?

  • Prevents network loops by disabling a port that stops receiving BPDUs (Bridge Protocol Data Units).
  • Protects against issues like unidirectional links, where data can only travel in one direction due to physical issues.

Unidirectional Links

  • Occur when data transmission is only possible in one direction.
  • Common causes: Layer 1 issues, damaged cables, faulty connectors, especially in fiber-optic cables.
  • Fiber-optic cables are more susceptible to physical damage than copper cables.

Problem Scenario

  • If a link becomes unidirectional but the switches do not detect the issue, it can lead to a Layer 2 loop.
  • BPDUs are not received, causing ports to mistakenly transition to the Forwarding state.

How Loop Guard Works

  • Does not prevent unidirectional links but prevents the loop caused by them.
  • When a Loop Guard-enabled port stops receiving BPDUs, it enters a "broken" (loop inconsistent) state rather than transitioning to Forwarding.
  • Recovery is automatic when the issue is resolved and BPDUs are received again.

Configuration

  • Can be configured per port or by default on all ports.
    • Per-port: SPANNING-TREE GUARD LOOP in interface config mode.
    • Global default: SPANNING-TREE LOOPGUARD DEFAULT in global config mode.
    • Disable on specific ports if needed with SPANNING-TREE GUARD NONE.

Loop Guard vs. Root Guard

  • Mutually Exclusive: Cannot be enabled on the same port simultaneously.
  • Root Guard: Prevents designated ports from becoming root ports.
  • Loop Guard: Prevents root or non-designated ports from becoming designated ports.

IOS Command Specificity

  • More specific configuration commands override less specific (e.g., interface command over global command).

Summary

  • Loop Guard protects against loops by disabling ports that stop receiving BPDUs.
  • Commonly used for unidirectional links caused by physical issues.
  • Two configuration methods: per-port or global default.
  • Incompatible with Root Guard on the same port.

Conclusion

  • Loop Guard is a valuable tool in the STP toolkit for maintaining network stability.
  • Automatically recovers when the issue is resolved.