Implementing STP

STP Nov 21, 2010

When multiple switches exist in the same layer 2 domain you run the risk of loops forming (bridging loops). Spanning Tree Protocol (STP) detects and prevents these loops. In essence if a loop exists the interfaces allowed to forward traffic are limited by preventing traffic being forwarded done (blocking). Over the years the STP has evolved with both standards based implementations and propriety ones;

  • 802.1d (STP)
  • 802.1w (RSTP)
  • 802.1s (MST/MISTP)
  • PVST+
  • Rapid-PVST+

Each have a slightly different way of preventing bridging loops, however a number of components exists with all.

STP goes through the following process

  1. Root Bridge Election
  2. Root port elections
  3. designated port election
  4. Bridging loops removed

STP Tiebreaker

  1. Lowest BID –  64 bit value (16 bit priority field and 48 bit MAC)
  2. Lowest path cost to the root
  3. lowest sender BID
  4. Lowest sender port ID

STP port states

  • Disabled
  • Blocking (20 seconds)
  • Listening (15 seconds)
  • Learning (15 seconds)
  • Forwarding


send every 2 sec

Improving STP Stability

  • Root Guard
  • UDLD
  • Loop Guard


#forward-time (#sec) – change time from the 50 seconds to shorter
bridge (#) protocol vlan-bridge

 spanning-tree vlan <id> root primary !# uses a macro that looks at the current root BID and sets a lower

spanning-tree vlan <id> root secondary !# also uses macro

spanning-tree vlan <id> priority <value>

spanning-tree link-type point-to-point

Lab Examples


  • Interconnections: Bridges, Routers, Switches, and Internetworking Protocols (2nd Edition) (Radia Perlman)
  • CCNP BCMSN: Exam Certification Guide (David Hucaby) – Ciscopress
  • CCNP Switch: Cert Kit (David Hucaby, Denise Donohue & Sean Wilkins) – Ciscopress


Rob Edwards

Northern (UK) chap focusing on platforms, automation, cloud and cloud native applications. Recovering network engineer, although it turns out networking is as important, if not more, now than before!