Spanning Tree Protocol (STP)

2.2 Given a scenario, configure switching technologies and features

📘CompTIA Network+ (N10-009)


What is STP?

STP (Spanning Tree Protocol) is a Layer 2 protocol used in switching networks to prevent loops.

In a network where switches are connected to each other with multiple paths, loops can happen. Loops can cause problems like:

  • Broadcast storms (messages circulating endlessly)
  • Multiple copies of the same frame
  • Network slowdown or crash

STP solves this by blocking redundant paths while keeping the network connected.


How STP Works

STP creates a loop-free logical topology by selecting:

  1. Root Bridge – the “main switch” of the network.
  2. Root Ports – the port on each non-root switch with the best path to the root bridge.
  3. Designated Ports – ports on each network segment that are chosen to forward traffic.
  4. Blocked Ports – ports that are not used to prevent loops.

Step 1: Electing the Root Bridge

  • All switches in the network exchange Bridge Protocol Data Units (BPDUs).
  • The switch with the lowest Bridge ID becomes the Root Bridge.
    • Bridge ID = Bridge Priority + MAC address
    • Lower value wins.

Example in IT environment: If you have 3 switches in a server room, the switch with the lowest Bridge ID becomes the Root Bridge, controlling traffic paths.


Step 2: Selecting Root Ports

  • Each switch identifies the port with the shortest path to the Root Bridge.
  • This port is called the Root Port.

Think of it as the “best exit” toward the main switch in the network.


Step 3: Selecting Designated Ports

  • On each network segment, the switch port with the lowest cost to the Root Bridge is the Designated Port.
  • This port forwards traffic for that segment.

Step 4: Blocking Redundant Ports

  • Ports that could cause loops but are not the Root Port or Designated Port are put into a blocked state.
  • Blocked ports don’t forward frames but can become active if the topology changes.

STP Port States

STP uses several port states to prevent loops when topology changes occur:

StateDescription
BlockingPort does not forward frames. Receives BPDUs.
ListeningPort listens to BPDUs to make sure no loops occur.
LearningPort starts learning MAC addresses but doesn’t forward frames yet.
ForwardingPort forwards frames and learns MAC addresses.
DisabledPort is administratively down, not participating in STP.

Exam tip: The progression is Blocking → Listening → Learning → Forwarding.


STP Path Cost

  • Each port has a cost based on its speed:
    • Fast ports = lower cost
    • Slow ports = higher cost
SpeedDefault STP Cost
10 Mbps100
100 Mbps19
1 Gbps4
10 Gbps2

STP always chooses the path with the lowest total cost to the Root Bridge.


STP Timers

STP uses timers to prevent loops and allow convergence:

TimerDefault ValuePurpose
Hello Timer2 secondsHow often BPDUs are sent
Forward Delay15 secondsTime spent in Listening & Learning states
Max Age20 secondsTime before a BPDU is considered outdated

STP Variants

  1. PVST+ (Per-VLAN Spanning Tree Plus)
    • Cisco proprietary
    • Each VLAN has its own STP instance
  2. Rapid STP (RSTP / 802.1w)
    • Faster convergence
    • Reduces downtime when network topology changes
  3. MSTP (Multiple Spanning Tree Protocol / 802.1s)
    • Maps multiple VLANs into fewer STP instances
    • Optimizes resource usage

Why STP is Important in IT Environments

  • Prevents broadcast storms in data centers.
  • Avoids duplicate frames between servers and switches.
  • Ensures high availability by using blocked ports as backup.
  • Works with VLANs using PVST+ for more efficient traffic separation.

Exam Tips

  1. Remember STP prevents loops in a Layer 2 network.
  2. Know the port roles: Root Port, Designated Port, Blocked Port.
  3. Memorize the port states: Blocking → Listening → Learning → Forwarding.
  4. Understand path cost and how root bridge is elected.
  5. Be familiar with STP variants: PVST+, RSTP, MSTP.

This is the complete overview you need for the CompTIA Network+ exam on STP. It focuses on how STP works, port states, timers, path costs, and variants—everything exam-relevant.

Leave a Reply

Your email address will not be published. Required fields are marked *

Buy Me a Coffee