Back to Dashboard
Module 7
Spanning Tree Protocol (STP)
β Previous Module
Next Module β
# π CCNA 200-301 - Video 7: Spanning Tree Protocol (STP) ## Deep Study Notes --- ## π Learning Objectives By the end of this video, you should understand: - Why STP is necessary (layer 2 loops) - How STP prevents loops - Root bridge election process - Port roles (Root, Designated, Alternate/Blocking) - Port states and transition - STP timers and convergence - Rapid Spanning Tree Protocol (RSTP) --- ## π§ Core Concepts ### 1. The Problem: Layer 2 Loops **Why Loops Happen:** Redundant links are necessary for network reliability, but they create loops in Layer 2 networks. **Analogy:** Think of a layer 2 loop like a group of people in a circle passing a letter. If one person sends a letter to everyone, it circulates endlessly because no one knows it's already been sent. ``` βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β LAYER 2 LOOP PROBLEM β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β βββββββββββββββ βββββββββββββββ β β β Switch A β β Switch B β β β β β β β β β β Port1 ββββββββββββββββββββββ Port1 β β β β β Link 1 β β β β β β β β β β β Port2 ββββββββββββββββββββββ Port2 β β β β β Link 2 β β β β βββββββββββββββ βββββββββββββββ β β β β PROBLEM: Broadcast frame from PC1 loops forever! β β β β STEP 1: PC1 sends broadcast β β STEP 2: Switch A floods out all ports (including Port2) β β STEP 3: Switch B receives on Port1, floods out all (including Port2) β β STEP 4: Switch A receives same frame on Port2, floods again β β STEP 5: Frame continues to circulate FOREVER! β β β β CONSEQUENCES: β β β’ Broadcast storms (network unusable) β β β’ MAC address table instability (flapping) β β β’ Multiple frame copies (duplicate packets) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ``` **Three Problems Caused by Loops:** | Problem | Description | Impact | |---------|-------------|--------| | **Broadcast Storm** | Broadcast frames circulate endlessly | Network saturation, complete outage | | **MAC Table Instability** | Switch learns MAC on multiple ports (flapping) | Forwarding table corruption | | **Duplicate Frames** | Multiple copies of same frame arrive | Application errors, resource waste | --- ### 2. The Solution: Spanning Tree Protocol (STP) **Definition:** STP (IEEE 802.1D) is a protocol that prevents Layer 2 loops by creating a logical loop-free topology while maintaining physical redundancy. **Analogy:** STP is like a traffic management system for a city with multiple bridges. Some bridges are "blocked" to prevent cars from driving in circles, but they can be reopened if the main bridge fails. **How STP Works:** ``` βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β STP LOGICAL TOPOLOGY β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β PHYSICAL TOPOLOGY (with loops): β β β β βββββββββββββββ βββββββββββββββ β β β Switch A β β Switch B β β β β (Root) β β β β β β β β β β β β Port1 ββββββββββββββββββββββ Port1 β β β β β Forwarding β β β β β β β β β β β Port2 ββββββββββββββββββββββ Port2 β β β β β Blocked β β β β βββββββββββββββ βββββββββββββββ β β β β STP LOGICAL TOPOLOGY (loop-free): β β β β βββββββββββββββ βββββββββββββββ β β β Switch A β β Switch B β β β β (Root) β β β β β β β β β β β β Port1 ββββββββββββββββββββββ Port1 β β β β β Forwarding β β β β β β β β β β β Port2 β X β Port2 β β β β β Blocked β β β β βββββββββββββββ βββββββββββββββ β β β β Result: No loop, but redundancy exists (blocked port becomes active β β if forwarding path fails) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ``` --- ### 3. STP Concepts and Terminology **Bridge Protocol Data Units (BPDUs):** | BPDU Type | Direction | Purpose | |-----------|-----------|---------| | **Configuration BPDU** | Root β Leaves | Contains bridge ID, path cost, timers; used for election and topology | | **TCN BPDU** (Topology Change Notification) | Leaves β Root | Notifies root of topology change | **Bridge ID (BID):** ``` βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β BRIDGE ID STRUCTURE β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β Bridge ID = Priority (4 bits) + Extended System ID (12 bits) + MAC Addressβ β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β Priority β Extended System ID β MAC Address β β β β (4 bits) β (12 bits) β (48 bits) β β β β Multiples of β = VLAN ID β Unique per switch β β β β 4096 β β β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β Example: Bridge ID = 32768 + 10 + MAC = 32778.MAC β β β β Default Priority: 32768 β β Range: 0-61440 (in multiples of 4096) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ``` **Path Cost:** | Link Speed | STP Cost (802.1D) | RSTP Cost (802.1t) | |------------|-------------------|-------------------| | 10 Mbps | 100 | 2,000,000 | | 100 Mbps | 19 | 200,000 | | 1 Gbps | 4 | 20,000 | | 10 Gbps | 2 | 2,000 | | 100 Gbps | 1 | 200 | --- ### 4. STP Election Process **Four-Step Election Process:** ``` βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β STP ELECTION PROCESS β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β STEP 1: ELECT ROOT BRIDGE β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β’ Switch with LOWEST Bridge ID becomes Root Bridge β β β β β’ Bridge ID = Priority + MAC Address β β β β β’ All ports on Root Bridge become Designated Ports β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β β βΌ β β STEP 2: ELECT ROOT PORTS β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β’ Each non-root switch selects ONE Root Port β β β β β’ Root Port = port with LOWEST path cost to Root Bridge β β β β β’ Only ONE Root Port per switch (except Root Bridge) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β β βΌ β β STEP 3: ELECT DESIGNATED PORTS β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β’ Each segment (link) selects ONE Designated Port β β β β β’ Designated Port = port with LOWEST path cost to Root β β β β β’ Root Bridge ports are always Designated β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β β βΌ β β STEP 4: BLOCK ALTERNATE PORTS β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β’ All remaining ports become Alternate/Blocked β β β β β’ Blocked ports do NOT forward traffic β β β β β’ Blocked ports listen for BPDUs (ready to take over if needed) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ``` --- ### 5. Port Roles **STP Port Roles:** ``` βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β STP PORT ROLES β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β βββββββββββββββββββ β β β ROOT BRIDGE β β β β Switch A β β β β Priority: 1 β β β ββββββββββ¬βββββββββ β β β β β Designated β Designated β β Port (DP) β Port (DP) β β β β β βββββββββββββββΌββββββββββββββ β β β β β β β βΌ βΌ βΌ β β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β β β Switch B β β Switch C β β Switch D β β β β Priority: 2 β β Priority: 3 β β Priority: 4 β β β ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ β β β β β β β Root Portβ Root Portβ Root Portβ β β (RP) β (RP) β (RP) β β β β β β β β βββββββββββββββββββββΌββββββββββββββββββββ β β β β β βββββββββΌβββββββββ β β β Link between β β β β Switch C & D β β β β β β β β DP on C β β β β Blocked on D β β β β (Alternate) β β β ββββββββββββββββββ β β β β PORT ROLES SUMMARY: β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β ROOT PORT (RP): Port on non-root switch with best path to rootβ β β β DESIGNATED PORT (DP): Port on segment with best path to root β β β β ALTERNATE PORT (AP): Blocked port (backup to Root Port) β β β β BACKUP PORT (BP): Blocked port (backup to Designated Port) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ``` **Port Role Decision Criteria (in order):** 1. **Lowest Root Bridge ID** (same for all ports on same network) 2. **Lowest Path Cost** to Root Bridge 3. **Lowest Sender Bridge ID** 4. **Lowest Sender Port ID** (Port Priority + Port Number) --- ### 6. Port States **STP Port States (802.1D):** ``` βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β STP PORT STATES β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β DISABLED β β β β β β (Port enabled) β β βΌ β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β BLOCKING β β β β β’ No frames forwarded β β β β β’ BPDUs received (listening for changes) β β β β β’ No MAC learning β β β β β’ Initial state after boot (20 sec max age) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β β β (20 sec - max age timer expires or receives better BPDU) β β βΌ β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β LISTENING β β β β β’ No frames forwarded β β β β β’ BPDUs sent/received (participating in election) β β β β β’ No MAC learning β β β β β’ Duration: 15 sec (forward delay) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β β β (15 sec - forward delay) β β βΌ β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β LEARNING β β β β β’ No frames forwarded β β β β β’ BPDUs sent/received β β β β β’ MAC learning (building CAM table) β β β β β’ Duration: 15 sec (forward delay) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β β β (15 sec - forward delay) β β βΌ β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β FORWARDING β β β β β’ Frames forwarded β β β β β’ BPDUs sent/received β β β β β’ MAC learning β β β β β’ Normal operation β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β TOTAL CONVERGENCE TIME: 50 seconds (20 + 15 + 15) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ``` **Port State Summary Table:** | State | Forward Data? | Learn MAC? | Send/Receive BPDU? | Duration | |-------|---------------|------------|--------------------|----------| | **Disabled** | No | No | No | Manual | | **Blocking** | No | No | Receive Only | 20 sec | | **Listening** | No | No | Yes | 15 sec | | **Learning** | No | Yes | Yes | 15 sec | | **Forwarding** | Yes | Yes | Yes | Permanent | --- ### 7. STP Timers | Timer | Default Value | Purpose | |-------|---------------|---------| | **Hello Time** | 2 seconds | How often root bridge sends BPDUs | | **Max Age** | 20 seconds | How long switch waits before re-electing (10 x Hello Time) | | **Forward Delay** | 15 seconds | Time in Listening/Learning states | **Timer Relationships:** - Max Age = 10 Γ Hello Time (default: 10 Γ 2 = 20 seconds) - Convergence = Max Age + (2 Γ Forward Delay) = 20 + (2 Γ 15) = 50 seconds --- ### 8. Root Bridge Selection Example ``` βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β ROOT BRIDGE ELECTION EXAMPLE β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β Switches with default priorities (32768): β β β β Switch A: Priority 32768, MAC: 00:11:11:11:11:11 β β Switch B: Priority 32768, MAC: 00:22:22:22:22:22 β β Switch C: Priority 32768, MAC: 00:33:33:33:33:33 β β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β STEP 1: Compare priorities (all equal: 32768) β β β β STEP 2: Compare MAC addresses (lowest wins) β β β β β β β β RESULT: Switch A (MAC: 00:11...) becomes Root Bridge β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β β To manually set a switch as root: β β β β Switch(config)# spanning-tree vlan 1 root primary β β (Sets priority to 24576) β β β β Switch(config)# spanning-tree vlan 1 root secondary β β (Sets priority to 28672) β β β β Switch(config)# spanning-tree vlan 1 priority 4096 β β (Manual priority configuration) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ``` --- ### 9. Rapid Spanning Tree Protocol (RSTP) - IEEE 802.1w **RSTP Improvements over STP:** | Feature | STP (802.1D) | RSTP (802.1w) | |---------|--------------|---------------| | **Convergence** | 30-50 seconds | < 1 second (typically 6-10 seconds) | | **Port States** | 5 states | 3 states | | **Port Roles** | 3 roles | 4 roles | | **Mechanism** | Passive (timers) | Active (handshake) | | **Backward Compatible** | N/A | Yes (with 802.1D) | **RSTP Port States:** | RSTP State | STP Equivalent | Forward Data? | Learn MAC? | |------------|----------------|---------------|------------| | **Discarding** | Blocking + Listening | No | No | | **Learning** | Learning | No | Yes | | **Forwarding** | Forwarding | Yes | Yes | **RSTP Port Roles:** ``` βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β RSTP PORT ROLES β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β ROOT PORT (RP): β β β’ Same as STP - best path to root bridge β β β β DESIGNATED PORT (DP): β β β’ Same as STP - port on segment with best path to root β β β β ALTERNATE PORT (AP): β β β’ Backup to Root Port β β β’ Discarding state (replaces STP Blocking) β β β’ Immediate transition to forwarding if Root Port fails β β β β BACKUP PORT (BP): β β β’ Backup to Designated Port (rare - only on shared segments) β β β’ Discarding state β β β β EDGE PORT: β β β’ RSTP concept (PortFast equivalent) β β β’ Connected to end device (PC, printer) β β β’ Immediately transitions to forwarding β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ``` **RSTP Convergence Mechanism:** ``` βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β RSTP PROPOSAL/AGREEMENT HANDSHAKE β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β Switch A (Root) Switch B β β β β β β β β β Proposal (I want to be Designated) β β β β ββββββββββββββββββββββββββββββββββββββΊ β β β β β β β β β (Switch B checks) β β β β - All other ports β β β β are synchronized β β β β β β β Agreement (OK, you can forward) β β β β ββββββββββββββββββββββββββββββββββββββ β β β β β β β β Port enters Forwarding β β β β β β β β β Result: Convergence in milliseconds (no timers required) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ``` --- ### 10. STP Features **PortFast:** | Feature | Description | |---------|-------------| | **Purpose** | Bypass STP states on access ports (connected to end devices) | | **Benefit** | Port immediately transitions to forwarding (no 30-50 sec delay) | | **Risk** | If connected to switch, can create loops (only use on access ports) | | **Command** | `spanning-tree portfast` | ```cisco ! Enable PortFast on access port Switch(config)# interface fastEthernet 0/1 Switch(config-if)# spanning-tree portfast Switch(config-if)# spanning-tree portfast disable ! Disable ! Enable PortFast globally on all access ports Switch(config)# spanning-tree portfast default ``` **BPDU Guard:** | Feature | Description | |---------|-------------| | **Purpose** | Protect against BPDUs on access ports (PortFast ports) | | **Benefit** | Disables port if BPDU received (prevents loops) | | **Action** | Puts port in errdisable state | | **Command** | `spanning-tree bpduguard enable` | ```cisco ! Enable BPDU Guard on PortFast ports Switch(config)# interface fastEthernet 0/1 Switch(config-if)# spanning-tree bpduguard enable ! Enable globally Switch(config)# spanning-tree portfast bpduguard default ``` **BPDU Filter:** | Feature | Description | |---------|-------------| | **Purpose** | Prevents sending/receiving BPDUs on a port | | **Risk** | Can create loops (use carefully) | | **Command** | `spanning-tree bpdufilter enable` | **UplinkFast and BackboneFast:** - **UplinkFast:** Faster convergence for access switches (Cisco proprietary) - **BackboneFast:** Faster convergence for backbone switches (Cisco proprietary) - **Note:** RSTP replaces these features --- ## π§ Commands ### STP Verification Commands ```cisco ! View STP status for all VLANs Switch# show spanning-tree ! View STP for specific VLAN Switch# show spanning-tree vlan 1 ! View STP summary (port roles) Switch# show spanning-tree summary ! View root bridge information Switch# show spanning-tree root ! View interface STP details Switch# show spanning-tree interface fastEthernet 0/1 ! View blocked ports Switch# show spanning-tree blockedports ``` **Example Output:** ```cisco Switch# show spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 24576 Address 0001.42A8.7C00 Cost 19 Port 1 (FastEthernet0/1) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32768 Address 0002.4A12.8B00 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/1 Root FWD 19 128.1 P2p Fa0/2 Desg FWD 19 128.2 P2p Fa0/3 Altn BLK 19 128.3 P2p ``` ### STP Configuration Commands ```cisco ! Set switch as root bridge for VLAN 1 Switch(config)# spanning-tree vlan 1 root primary ! Set switch as secondary root (backup) Switch(config)# spanning-tree vlan 1 root secondary ! Manual priority configuration (multiples of 4096) Switch(config)# spanning-tree vlan 1 priority 4096 ! Change STP mode Switch(config)# spanning-tree mode pvst ! Per-VLAN STP (default) Switch(config)# spanning-tree mode rapid-pvst ! RSTP per VLAN Switch(config)# spanning-tree mode mst ! Multiple Spanning Tree ! Change link cost manually Switch(config)# interface fastEthernet 0/1 Switch(config-if)# spanning-tree cost 10 ! Change port priority (lower is better) Switch(config-if)# spanning-tree port-priority 16 ! Enable PortFast Switch(config-if)# spanning-tree portfast ! Enable BPDU Guard Switch(config-if)# spanning-tree bpduguard enable ! Enable UplinkFast Switch(config)# spanning-tree uplinkfast ! Enable BackboneFast Switch(config)# spanning-tree backbonefast ! Verify STP modes Switch# show spanning-tree summary ``` --- ## π Text-Based Diagrams ### STP Topology Example ``` βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β COMPLETE STP EXAMPLE β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β βββββββββββββββ β β β Switch A β β β β Root β β β β Priority:1 β β β β 32768.MAC-A β β β ββββββββ¬βββββββ β β β β β Cost 19 βββββββ΄ββββββ Cost 19 β β (DP) β β (DP) β β β β β β βββββββββββΌββββ βββββββΌββββββββββ β β β Switch B β β Switch C β β β β Priority:2 β β Priority:3 β β β β 32768.MAC-B β β 32768.MAC-C β β β ββββββββ¬βββββββ βββββββββ¬ββββββββ β β β β β β Cost 19β βCost 19 β β (RP) β β(RP) β β β β β β β Cost 19 β β β βββββββββββββββββ β β (DP on C, BLK on B) β β β β LEGEND: β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β DP = Designated Port (Forwarding) β β β β RP = Root Port (Forwarding) β β β β BLK = Blocked Port (Alternate) β β β β βββ = Link β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ``` ### STP State Transition Diagram ``` βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β STP STATE MACHINE β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β βββββββββββββββββββ β β βββββββΊβ DISABLED ββββββββ β β β βββββββββββββββββββ β β β β β β β β β β Port Enabled β β β β βΌ β β β β βββββββββββββββββββ β β β β β BLOCKING β β β β β βββββββββββββββββββ β β β β β β β β β β Max Age (20s) β β β β β or Better BPDU β β β β βΌ β β β β βββββββββββββββββββ β β β β β LISTENING β β β β β βββββββββββββββββββ β β β β β β β β β β Forward Delay β β β β β (15s) β β β β βΌ β β β β βββββββββββββββββββ β β β β β LEARNING β β β β β βββββββββββββββββββ β β β β β β β β β β Forward Delay β β β β β (15s) β β β β βΌ β β β β βββββββββββββββββββ β β β β β FORWARDING β β β β β βββββββββββββββββββ β β β β β β β ββββββββββββββββββββββββββββββββββ β β (Port becomes Alternate) β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ``` --- ## β Exam Tips (For CCNA 200-301) | Topic | What Cisco Tests | |-------|------------------| | **STP Purpose** | Prevents Layer 2 loops | | **Root Bridge Election** | Lowest Bridge ID (Priority + MAC) wins | | **Port Roles** | Root, Designated, Alternate (Blocking) | | **Port States** | Blocking, Listening, Learning, Forwarding (Disabled) | | **Convergence Time** | 50 seconds (default STP) | | **RSTP** | 802.1w, faster convergence (< 10 sec) | | **PortFast** | Bypass STP on access ports | | **BPDU Guard** | Disable port if BPDU received | ### Common Exam Scenarios: **Scenario 1:** "A switch with priority 4096 and MAC 00:11:22:33:44:55 is added to a network. What happens?" - **Answer:** It becomes root bridge because priority (4096) is lower than default (32768) **Scenario 2:** "A user reports slow connectivity after connecting to a switch port. The port takes 30 seconds to become active. What feature should be enabled?" - **Answer:** PortFast (bypasses Listening/Learning states) **Scenario 3:** "A switch receives BPDU on a port configured with PortFast and BPDU Guard. What happens?" - **Answer:** Port goes into errdisable state (prevents potential loop) ### Mnemonics: **STP Port States (order):** **"BLT (with) L F"** - **B**locking - **L**istening - **L**earning - **F**orwarding **STP Election Criteria:** **"4 P's: Path, Priority, Port"** 1. **P**ath Cost (lowest) 2. **P**riority (lowest Bridge ID) 3. **P**ort Priority (lowest) 4. **P**ort Number (lowest) **STP Timers:** **"Hello 2, Max 20, Forward 15"** --- ## π Summary (1-Minute Revision) ``` STP (802.1D): βββ Purpose: Prevent Layer 2 loops βββ Convergence: 50 seconds βββ Port States: Blocking β Listening β Learning β Forwarding βββ Port Roles: Root, Designated, Alternate ELECTION: βββ Lowest Bridge ID = Root Bridge βββ Bridge ID = Priority (default 32768) + MAC βββ Path Cost determines Root/Designated ports RSTP (802.1w): βββ Faster convergence (< 10 sec) βββ Port States: Discarding, Learning, Forwarding βββ Port Roles: Root, Designated, Alternate, Backup βββ Proposal/Agreement handshake (no timers) STP FEATURES: βββ PortFast: Immediate forwarding on access ports βββ BPDU Guard: Disable port if BPDU received βββ UplinkFast: Faster convergence for access switches βββ BackboneFast: Faster convergence for backbone KEY COMMANDS: βββ show spanning-tree βββ spanning-tree vlan 1 root primary βββ spanning-tree portfast βββ spanning-tree bpduguard enable ``` --- ## π§ͺ Practice Questions **1. What is the primary purpose of Spanning Tree Protocol?** - A) Increase network speed - B) Prevent Layer 2 loops - C) Provide IP addressing - D) Route between VLANs <details> <summary>Answer</summary> <b>B) Prevent Layer 2 loops</b> - STP creates a logical loop-free topology while maintaining physical redundancy. </details> **2. Which switch becomes the root bridge in an STP network?** - A) Switch with highest MAC address - B) Switch with lowest MAC address - C) Switch with lowest bridge ID - D) Switch with highest bridge ID <details> <summary>Answer</summary> <b>C) Switch with lowest bridge ID</b> - Bridge ID = Priority + MAC address; lowest wins. </details> **3. How long does it take for a default STP network to converge?** - A) 2 seconds - B) 15 seconds - C) 30 seconds - D) 50 seconds <details> <summary>Answer</summary> <b>D) 50 seconds</b> - Max Age (20s) + Forward Delay (15s) + Forward Delay (15s) = 50 seconds. </details> **4. In which STP port state does a switch learn MAC addresses?** - A) Blocking - B) Listening - C) Learning - D) Forwarding <details> <summary>Answer</summary> <b>C) Learning</b> - MAC learning occurs in Learning state; forwarding occurs in Forwarding state. </details> **5. What is the default STP priority on Cisco switches?** - A) 1 - B) 4096 - C) 32768 - D) 65535 <details> <summary>Answer</summary> <b>C) 32768</b> - Default priority is 32768 (in multiples of 4096). </details> **6. Which port role is always in forwarding state on the root bridge?** - A) Root Port - B) Designated Port - C) Alternate Port - D) Blocked Port <details> <summary>Answer</summary> <b>B) Designated Port</b> - All ports on the root bridge are Designated Ports and forward traffic. </details> **7. What does PortFast do?** - A) Increases port speed - B) Bypasses STP states on access ports - C) Disables STP entirely - D) Makes port a trunk <details> <summary>Answer</summary> <b>B) Bypasses STP states on access ports</b> - PortFast immediately transitions to forwarding, skipping Listening/Learning. </details> **8. What happens when BPDU Guard is enabled on a port that receives a BPDU?** - A) Port becomes root port - B) Port goes into errdisable state - C) Port continues normal operation - D) Switch reboots <details> <summary>Answer</summary> <b>B) Port goes into errdisable state</b> - BPDU Guard disables the port to prevent potential loops. </details> **9. Which IEEE standard defines Rapid Spanning Tree Protocol?** - A) 802.1D - B) 802.1Q - C) 802.1w - D) 802.3 <details> <summary>Answer</summary> <b>C) 802.1w</b> - 802.1D is original STP, 802.1w is RSTP. </details> **10. A switch has two paths to the root bridge: one with cost 19 (100 Mbps) and one with cost 4 (1 Gbps). Which path becomes the root port?** - A) The 100 Mbps path - B) The 1 Gbps path - C) Both become root ports - D) Neither <details> <summary>Answer</summary> <b>B) The 1 Gbps path</b> - Lower path cost (4) is better than higher cost (19). </details> **11. What is the default hello time for STP?** - A) 1 second - B) 2 seconds - C) 5 seconds - D) 10 seconds <details> <summary>Answer</summary> <b>B) 2 seconds</b> - Root bridge sends BPDUs every 2 seconds. </details> **12. Which command sets a switch as the root bridge for VLAN 1?** - A) `spanning-tree root primary` - B) `spanning-tree vlan 1 root` - C) `spanning-tree vlan 1 root primary` - D) `set root vlan 1` <details> <summary>Answer</summary> <b>C) `spanning-tree vlan 1 root primary`</b> - This sets priority to 24576. </details> --- ## π Next Steps After completing Video 7, you should be ready for: - **Video 8:** Inter-VLAN Routing (Router-on-a-Stick) - **Video 9:** EtherChannel **Lab Practice:** 1. Build a network with 3 switches in a triangle 2. Observe STP convergence (use `show spanning-tree`) 3. Identify root bridge, root ports, designated ports, blocked ports 4. Change root bridge priority and observe changes 5. Enable PortFast on access ports 6. Configure BPDU Guard and test 7. Change STP mode to Rapid-PVST --- **Ready for Video 8?** Share the link or say "next" and I'll continue with Inter-VLAN Routing (Router-on-a-Stick). I'll create comprehensive deep notes for **Video 8: Inter-VLAN Routing** based on the standard CCNA 200-301 curriculum. ---