Description

Spanning Tree Protocol (STP) is a critical Layer 2 protocol that prevents network loops while maintaining redundant paths. On Juniper EX and QFX Series switches, proper STP configuration is essential for network stability and reliability. 

The protocol works by:

  • Creating a loop-free logical topology
  • Automatically disabling redundant paths that could create loops
  • Providing automatic failover to backup paths when active links fail

Proper configuration of STP is crucial because:

  • It prevents broadcast storms that can bring down your network
  • It ensures optimal path selection in your Layer 2 network
  • It provides automatic failover capabilities for network resilience
  • It allows interoperability with other vendors' equipment in mixed environments

Symptoms

Example of a loop:
[Switch1] ------- [switch2]
       \                        /
         \                    /
           \                /
           [
Switch 3 ]

 

Role Planning

Before implementing STP, it's crucial to:

  1. Identify which switch will be the root bridge
    • Usually the most centrally located switch
    • Consider backup root bridge placement
  2. Document your intended topology
    • Primary paths
    • Backup paths
    • Edge ports (connections to end devices)

STP Variant Selection

Choose the appropriate STP variant based on your requirements:

  1. RSTP (Rapid Spanning Tree Protocol)
    • Default protocol on EX/QFX switches
    • Best choice for most modern networks
    • Faster convergence than traditional STP
    • Use when quick failover is required
  2. Traditional STP
    • Use when connecting to legacy 802.1D 1998 bridges
    • Slower convergence but more compatible with older equipment
    • Configure by forcing RSTP to run in STP mode
  3. MSTP (Multiple Spanning Tree Protocol)
    • Use when you need multiple spanning tree instances
    • Good for large networks with many VLANs
    • Supports up to 64 instances
    • More complex to configure and troubleshoot
  4. VSTP (VLAN Spanning Tree Protocol)
    • Use when interoperating with Cisco's PVST+
    • One instance per VLAN
    • Limited to 253 VLANs on EX9200
    • Up to 510 VLANs on EX4300, EX4600, and QFX Series

Solution

A) Basic STP Configuration Steps

A.1. Enabling STP on the Switch
By default, RSTP is enabled on EX and QFX switches. If you need to configure traditional STP:[edit protocols]
user@switch# delete rstp                   # First delete RSTP
user@switch# set stp                       # Enable STP globally

For forcing RSTP to run in STP mode (recommended method):
[edit protocols]
user@switch# set rstp force-version 0      # Forces RSTP to run in STP compatibility mode

A.2. Adding Interfaces to STP
You can enable STP on all interfaces or specific interfaces:

For all interfaces:
[edit protocols]
user@switch# set stp interface all

For specific interfaces:
[edit protocols]
user@switch# set stp interface ge-0/0/0
user@switch# set stp interface ge-0/0/1

Configure root bridge priority (optional but suggested):
[edit protocols]
user@switch# set stp bridge-priority 16k   # Lower value increases the chance of becoming the root bridge

A.3. Verifying STP Configuration


Basic configuration verification:
user@switch> show configuration protocols stp
user@switch> show spanning-tree bridge
user@switch> show spanning-tree interface

 

B) Optional Advanced Configurations

1. Edge Port Configuration:
[edit protocols]
user@switch# set stp interface ge-0/0/10 edge  # For ports connected to end devices


2. Root Protection:
[edit protocols]
user@switch# set stp interface ge-0/0/1 root-protection

3. BPDU Protection:
[edit protocols]
user@switch# set stp interface ge-0/0/2 bpdu-block

4. Cost Configuration:
[edit protocols]
user@switch# set stp interface ge-0/0/3 cost 1000

Modification History

2026-06-05: Merge of 2 KBs

2024-02-26 : Article Created

Related Information

Additional documentation for troubleshooting: