🌳 Spanning Tree Protocol (STP)

 

🌳 Spanning Tree Protocol (STP)


🧠 Top 5 Key Points

  1. Prevents Switching Loops:
    STP detects and blocks redundant links in a network to prevent broadcast storms and MAC table instability.

  2. Selects a Root Bridge:
    The switch with the lowest Bridge ID (Priority + MAC address) becomes the Root Bridge for the network.

  3. Blocks Redundant Links:
    Non-essential paths are put into a blocking state, ensuring a single active path between any two switches.

  4. Uses Bridge Protocol Data Units (BPDUs):
    Switches exchange BPDUs to share information about the network topology and root bridge.

  5. Automatically Reconfigures:
    If an active link fails, STP recalculates and unblocks a redundant link to restore connectivity — ensuring fault tolerance.


⚙️ Technical Summary

FeatureDescription
Layer2 (Data Link Layer)
StandardIEEE 802.1D (Classic STP)
TypesSTP, RSTP (802.1w), MSTP (802.1s)
Convergence Time30–50 seconds (STP), faster in RSTP
BPDU TransmissionEvery 2 seconds

🧰 Packet Tracer Lab: STP in Action

🎯 Goal:

Demonstrate how STP prevents loops when multiple switches are interconnected.


🖥️ Network Topology

[Switch1] / \ [Switch2]--[Switch3]

Lab Description

  • All switches connected in a triangle (loop).

  • STP ensures one redundant link is blocked automatically to prevent loops.


🪜 Step-by-Step Configuration

🔹 On All Switches (S1, S2, S3)

enable conf t spanning-tree vlan 1

This enables STP for VLAN 1 (default VLAN).
(It’s enabled by default on Cisco switches, but this reinforces the concept.)


🔹 Check Root Bridge

Run the command:

show spanning-tree

Example output:

Root ID Priority 32769 Address 0001.42B3.7C10 This bridge is the root
  • The switch with the lowest Bridge ID (Priority + MAC) is the Root Bridge.

  • Other switches will have some ports in forwarding state and one port in blocking state.


🔹 Force a Specific Root Bridge

Let’s make Switch1 the Root Bridge (for demonstration).

enable conf t spanning-tree vlan 1 priority 4096

💡 Lower priority = higher chance of becoming Root Bridge.
(Default is 32768, so 4096 makes this switch root.)

Now verify again:

show spanning-tree

Switch1 will now show:

This bridge is the root

🔹 Observe Port Roles

  • Root Port: Best path to Root Bridge.

  • Designated Port: Forwarding port on the segment.

  • Blocked Port: Prevents loops (in “Blocking” or “Discarding” state).

You can see port roles using:

show spanning-tree interface

🔹 Test STP in Action

  1. From the topology, disconnect one active link between Switch1 and Switch2.

  2. Watch STP automatically unblock a previously blocked link between Switch2 and Switch3 — restoring full connectivity.

✅ This demonstrates STP convergence and loop prevention dynamically.


🧠 Key Learning Summary

ConceptDescription
STP PurposePrevents loops in Layer 2 networks
Root BridgeCentral switch selected by lowest Bridge ID
BPDUControl messages exchanged between switches
Blocked PortsAvoid loops by disabling redundant links
FailoverAutomatically unblocks redundant link on failure

💬 Teaching Tip

“STP is like a traffic controller — it lets only one car (frame) pass on a given path and keeps the others waiting, but if the main road closes, it quickly opens an alternate route.”

Comments

Popular posts from this blog

🖥️ Private IP vs Public IP Address

🧠 Introduction to CCNA Networking