Projects
Writings
Notes
Log
Glossary
Contact

STP Field Notes

April 13, 2026

Configuration, verification, and operational behavior of Spanning Tree

bash
conf t
spanning-tree mode mst
spanning-tree mst configuration
name CCNPv8
revision 2
instance 1 vlan 2,3
instance 2 vlan 3,4
!show pending
exit
end

Spanning Tree Protocol (STP) Configuration Cheatsheet

1. Verify STP Configuration

Show STP Information

bash
show spanning-tree

Show STP Status for a Specific VLAN

bash
show spanning-tree vlan [vlan-id]

Show STP Details on Interfaces

bash
show spanning-tree interface [interface-id]

2. Configure STP Modes

Enable STP (Default for most Cisco switches)

bash
no spanning-tree vlan [vlan-id]

Enable PVST+ (Default on Cisco Switches)

bash
spanning-tree mode pvst

Enable Rapid PVST+

bash
spanning-tree mode rapid-pvst

Enable MST

bash
spanning-tree mode mst

3. Adjust STP Parameters

Set Bridge Priority

bash
spanning-tree vlan [vlan-id] priority [value]
  • Default Range: 0-61440, increments of 4096
  • Default Value: 32768

Set Bridge Cost

bash
spanning-tree cost [value]
  • Default Values: Varies by interface speed (e.g., 100 Mbps = 19)

Set Hello Time

bash
spanning-tree hello-time [seconds]
  • Default Value: 2 seconds

Set Forward Delay

bash
spanning-tree forward-delay [seconds]
  • Default Value: 15 seconds

Set Max Age

bash
spanning-tree max-age [seconds]
  • Default Value: 20 seconds

Set Root Bridge Priority

bash
spanning-tree vlan [vlan-id] root primary
  • Or use root secondary for a secondary root bridge

Configure Portfast

bash
spanning-tree portfast
  • Use spanning-tree portfast trunk for trunk ports

Configure BPDU Guard

bash
spanning-tree bpduguard enable

Configure BPDU Filter

bash
spanning-tree bpdufilter enable

Configure Edge Port (PortFast)

bash
spanning-tree portfast edge

4. MST Configuration

Define MST Instances

bash
spanning-tree mst configuration
instance [instance-id] vlan [vlan-id]
name [name]
revision [number]

Map VLANs to MST Instances

bash
instance [instance-id] vlan [vlan-list]

Verify MST Configuration

bash
show spanning-tree mst configuration

Examples

Configure PVST+ and Set Bridge Priority

bash
Switch# configure terminal
Switch(config)# spanning-tree mode pvst
Switch(config)# spanning-tree vlan 1 priority 4096

Configure PortFast on an Interface

bash
Switch# configure terminal
Switch(config)# interface GigabitEthernet0/1
Switch(config-if)# spanning-tree portfast

Configure MST Instances

bash
Switch# configure terminal
Switch(config)# spanning-tree mst configuration
Switch(config-mst)# instance 1 vlan 10,20
Switch(config-mst)# instance 2 vlan 30
Switch(config-mst)# name MST-PROTOCOL
Switch(config-mst)# revision 1

Set Root Bridge Priority

bash
Switch# configure terminal
Switch(config)# spanning-tree vlan 1 root primary

Key Concepts

  • Root Bridge: The central switch with the lowest Bridge ID.
  • Port Cost: Determines the best path to the root bridge; lower costs are preferred.
  • BPDU (Bridge Protocol Data Unit): Messages exchanged between switches to maintain STP.
  • PortFast: Allows ports to transition to the forwarding state immediately, used for end-user devices.
  • BPDU Guard: Prevents unauthorized devices from affecting the STP topology.
  • MSTP: Supports multiple spanning trees, allowing different STP instances per VLAN.
Dart
Java
Python
Pytest
LaTeX
JavaScript
Jest
TypeScript
React
Gatsby
HTML
Markdown
CSS
Sass
Bootstrap
Tailwind CSS
Django
Flask
Flutter
SQLite

© 2025–2026 manjana/blue-hexagon

Connect with me on GitHub or LinkedIn

PostgreSQL
Nginx
Postman
Terraform
Vim
Git
Github
Heroku
Docker
GitHub Actions
Linux
DigitalOcean
JetBrains
PyCharm
Bash
VMWare
Cisco
Ansible
Paloalto