Skip to main content

Days 20, 21, 22: Spanning Tree Protocol

CCNA 200-301 Study Guide: Layer 2 Switching and Spanning Tree Protocol

1.0 The Critical Need for Spanning Tree Protocol (STP)STP & RSTP): CCNA Reference Sheet

Core Problem & Solution

InProblem: modernRedundant networks,network redundancypaths is a necessity (for highreliability) availability. However, redundant physical links atcreate Layer 2 createloops a lethal risk: switching loops. Unlike Layer 3 packets, which have a Time-to-Live (TTL) field to kill a packet if it circles too long, Layer 2 Ethernet frames have no expiration mechanism.

The Consequences of a Loop

    Broadcast Storms: A single→ broadcast frame is duplicated endlessly, consuming all bandwidthstorms and crashingMAC switchflapping CPUs.→ network collapse.

    Solution:

    STP

    MACprevents Tableloops Instabilityby (MACblocking Flapping): The switch sees the same source MAC appearing on differentredundant ports simultaneously,while causingmaintaining its forwarding logic to fail.backups.

    Key Concept:

    Duplicate Frame Delivery: A host receives multiple copies of the same unicast frame, causing application errors.

    The Metaphor: Think of STP as a Tree Pruner. It looks at a messy, circular bush of redundant wires and "prunes" (blocks) specific branches so that only a single, logical tree remains where every leaf (host) has exactly one path to the root.

    2.0 Core Mechanics of Legacy STP (IEEE 802.1D)

    STP creates a loop-free topologyspanning tree topology; redundant links disabled until primary fails.


    Core Definitions

    Broadcast Storm: Frame loops indefinitely in network, multiplying copies exponentially; consumes all bandwidth; causes network collapse.

    MAC Address Flapping: Same MAC address seen on different ports in rapid succession due to looping frames; switch continuously updates MAC table; packet forwarding becomes unreliable.

    Spanning Tree Protocol (STP): Layer 2 protocol preventing loops by electingblocking asome singleports (BLOCKING state) while enabling others (FORWARDING); runs by default on all Cisco switches.

    Bridge Protocol Data Unit (BPDU): STP message sent every 2 seconds (Hello Timer) containing bridge ID, root bridge ID, cost to root, and port ID; used for root election and topology discovery.

    Bridge ID: 2-byte priority + 6-byte MAC address; lowest bridge ID wins root election (priority first, then MAC).

    Root Bridge: "Center" of spanning tree topology; reference point calledfor theall cost calculations; all its ports are DESIGNATED and FORWARDING.

    Root Bridge.Port: ONE port per switch (except root) closest to root bridge; determined by lowest cost path to root; FORWARDING state.

    2.1

    Designated ThePort: ONE port per segment (collision domain) with lowest cost to root; FORWARDING state; other port in segment is NON-DESIGNATED.

    Non-Designated Port: Remaining ports in segments; BLOCKING state; serves as backup/redundant link.


    Root Bridge Election

    The switch with the numerically lowest& Bridge ID (BID)

    Election isRule: electedLowest thebridge RootID Bridge.becomes root; if tied, lowest MAC address breaks tie.

    $$Bridge\Bridge ID =Structure:

    Bridge\
    Priority Priority(2 bytes) + Extended\MAC System\ ID\Address (VLAN\6 ID)bytes)
    +
    MAC\ Address$$

    Priority:

    • Default:

      Default32768

    Priority: 32,768 (mustMust be changed in increments of 4,096)4096: 0, 4096, 8192, 12288, 16384, 20480, 24576, 28672, 32768.. . Lower

    Tie-breaker:= Ifhigher prioritiespriority arefor equal, the switch with the lowest MAC address wins.

    root Minimum:

    Outcome: All ports on the Root Bridge are Designated Ports0 (DP)highest and are in a forwarding state.

    priority)

    2.2

    Example Election:

    SW1: Priority 32768 + MAC 00:1a:2b:3c:4d:5e
    SW2: Priority 32768 + MAC 00:1a:2b:3c:4d:5f
    
    Same priority → compare MAC
    SW1 has lower MAC → SW1 becomes ROOT BRIDGE
    

    Configuration:

    Switch(config)# spanning-tree vlan 1 root primary
      → Sets priority to 24576 (likely to be root)
    
    Switch(config)# spanning-tree vlan 1 root secondary
      → Sets priority to 28672 (backup root; takes over if primary fails)
    

    STP Costs & Path Selection

    Classic STP PathPort CostCosts

    Each non-root switch finds the "cheapest" path to the root based on cumulative(by link costs.speed):