Cisco Spanning Tree (STP) Configuration

M. Ichsanul Fadhil•November 21, 2026•7 min read

Prevent Layer 2 broadcast loops by configuring spanning-tree bridge priorities, root bridge election, and port blocking roles.

spanning-tree.simneta
Topology Preview

In modern enterprise campuses, relying on a single uplink cable between distribution and access switches invites immediate disaster. If a maintenance worker snaps that single fiber run, an entire department or office floor goes dark instantly.

To ensure uninterrupted business operations, engineers design dual-tier diamond topologies. Every access switch maintains dual physical connections linking upstream to two separate distribution switches. However, this redundant physical cabling introduces a fatal Ethernet vulnerability: switching loops and catastrophic broadcast storms.

Because Layer 2 Ethernet frames lack a Time-To-Live (TTL) field, an ordinary broadcast frame like an ARP request circulates in endless loops across redundant switches. Within milliseconds, duplicate frames multiply exponentially, driving switch CPUs to 100% and completely collapsing network operations.

Diamond 4-Switch Campus Topology Loop Elimination via STP Port Roles

Figure 1. Deterministic Loop Elimination: Dual-Core Diamond Architecture with STP Alternate Blocking

Deterministic Root Election: Avoiding the Default MAC Hazard

The Spanning Tree Protocol (STP / IEEE 802.1D) prevents loops by electing a central reference authority called the Root Bridge. In unmanaged networks where all switches keep the default priority (32768), election victory falls entirely on the lowest physical MAC address.

This default behavior poses a dangerous risk: an older, slower access switch in a utility closet might possess an older, numerically lower MAC address than a high-performance distribution switch. The entire campus network would inadvertently forward traffic through that bottleneck switch.

Deterministic Bridge Priority Hierarchy
Primary Core Distribution (SW1) → Priority 4096 (Wins Root Election)
Secondary Backup Core (SW2) → Priority 8192 (Automatic Standby Takeover)
Standard Access Layer (SW3, SW4) → Priority 32768 (Default Non-Root Mode)

Configuring bridge priorities in deliberate increments of 4096 ensures deterministic traffic engineering. All ports on Root Bridge SW1-Root take the Designated Forwarding role, while access switches place redundant standby uplinks toward SW2-Backup into an Alternate Blocking (BLK) state.

Campus Addressing & Switch Port Roles

All devices communicate inside the flat 192.168.1.0/24 subnet. Access switches connect host workstations to redundant distribution uplinks:

Device Bridge Priority STP Operational Role Port States & Connections
SW1-Root Priority 4096 Primary Root Bridge Fa0/1, Fa0/2, Fa0/3 → All Designated (FWD)
SW2-Backup Priority 8192 Secondary Backup Root Fa0/3 (Root FWD), Fa0/1 & Fa0/2 (Designated FWD)
SW3-Access1 Priority 32768 Access Tier Switch Fa0/1 (Root FWD), Fa0/2 (Alternate BLK), Fa0/3 (PC-Admin)
SW4-Access2 Priority 32768 Access Tier Switch Fa0/2 (Root FWD), Fa0/1 (Alternate BLK), Fa0/3 (PC-Client)
PC-Admin FastEthernet0 Host Workstation 192.168.1.10/24 (Gateway: 192.168.1.1)
PC-Client FastEthernet0 Host Workstation 192.168.1.20/24 (Gateway: 192.168.1.1)
Automated Diamond Uplink Failover on Primary Link Severance

Figure 2. Automated Diamond Failover: Transitioning Alternate Standby Links to Forwarding on Primary Uplink Severance

Step-by-Step Hands-On STP Configuration

1

Enforce Deterministic Primary Root on SW1

Configure bridge priority 4096 on SW1-Root so it decisively wins root bridge elections across the campus:

# Configure Primary Root Bridge on SW1:
SW1-Root(config)# spanning-tree vlan 1 priority 4096
SW1-Root# show spanning-tree vlan 1
VLAN0001
Root ID Priority 4097 (sys-id-ext 1)
This bridge is the root
Interface Role Sts Cost Prio.Nbr Type
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Desg FWD 19 128.2 P2p
Fa0/3 Desg FWD 19 128.3 P2p
2

Establish Secondary Standby Root on SW2

Configure bridge priority 8192 on SW2-Backup so it automatically takes over root duties if the primary switch experiences a power outage:

# Configure Secondary Backup Root on SW2:
SW2-Backup(config)# spanning-tree vlan 1 priority 8192
SW2-Backup# show spanning-tree vlan 1
Bridge ID Priority 8193 (sys-id-ext 1)
Interface Role Sts Cost Prio.Nbr Type
Fa0/3 Root FWD 19 128.3 P2p
3

Verify Port Roles and Alternate Blocking on Access Switches

Inspect SW3-Access1 to confirm that its direct uplink to SW1 is Root Forwarding while its redundant uplink to SW2 is placed into an Alternate Blocking state:

# Check port roles on SW3-Access1:
SW3-Access1# show spanning-tree vlan 1
Interface Role Sts Cost Prio.Nbr Type
Fa0/1 Root FWD 19 128.1 P2p
Fa0/2 Altn BLK 19 128.2 P2p
Fa0/3 Desg FWD 19 128.3 P2p
4

Simulate Primary Uplink Cut & Confirm Instant Failover

Shut down the primary root uplink on interface Fa0/1 of SW3-Access1. Observe that standby interface Fa0/2 transitions from BLK to FWD, keeping ping traffic flowing smoothly:

# 1. Shut down primary uplink on SW3:
SW3-Access1(config)# interface FastEthernet0/1
SW3-Access1(config-if)# shutdown
# 2. Verify pings from PC-Admin to PC-Client remain successful:
PC-Admin> ping 192.168.1.20
Pinging 192.168.1.20 with 32 bytes of data:
Reply from 192.168.1.20: bytes=32 time<1ms TTL=128
Reply from 192.168.1.20: bytes=32 time<1ms TTL=128
Reply from 192.168.1.20: bytes=32 time<1ms TTL=128
Reply from 192.168.1.20: bytes=32 time<1ms TTL=128
Ping statistics: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)
Key Takeaways: Cisco Spanning Tree Protocol
  • Deterministic Root Priority: Lower bridge priorities in multiples of 4096 (4096 for Primary, 8192 for Backup) prevent low-end access switches from becoming Root Bridge.
  • Universal Designated Forwarding: All active operational ports residing directly on the Root Bridge are placed in the Designated Forwarding role.
  • Loop Elimination via Alternate Blocking: Access switches place redundant standby uplinks into the Alternate Blocking (BLK) state, turning physical loops into loop-free trees.
  • Automated Link Failover: When an active root path is severed, STP unblocks the standby link, automatically redirecting packets with zero manual intervention.

Discussion & Community Notes

Ask questions, share configuration solutions, or discuss this practice lab.

0 Comments
Posting as Guest • 1-level replies supported