-
STP Convergence Process
-
Root Bridge Election
-
Lowest Bridge ID (BID): Priority + MAC
-
Lowest Priority
- Default 32,768
- Lowest MAC Address
-
Root Port Selection
- Non-Root Switch
-
Least Root Path Cost
-
spanning-tree pathcost method short
- 10 Mbps: 100
- 100 Mbps: 19
- 1 Gbps: 4
- 10 Gbps: 2
-
spanning-tree pathcost method long
- 10 Mbps: 2,000,000
- 100 Mbps: 200,000
- 1 Gbps: 20,000
- 10 Gbps: 2,000
- 100 Gbps: 200
- 1 Tbps: 20
- 10 Tbps: 2
-
Tiebreakers:
- 1: Lowest Neighbor BPDU BID
- 3: Lowest Local BID
- 4: Lowest Local PID
-
Designated Port Selection
- LAN Segment (Collision Domain)
- Least Root Path Cost listed in exchanged BPDU
-
Tiebreakers:
- 1: Lowest Neighbor BPDU BID
- 2: Lowest Local BID
- 3: Lowest Local PID
-
Block All Other Ports
- All non-root ports and all non-designated ports are blocked
-
STP Operation
-
STP BPDUs
-
Types
- Topology Change Notification
- Configuration
-
Format
- Protocol ID 16 bits
- Version 8 bits
- BPDU Type 8 bits
- Flags 8 bits
- Root ID 64 bits
- Root Path Cost 32 bits
- Bridge ID 64 bits
- Port ID 16 bits
- Message Age 16 bits
- Max Age 16 bits
- Hello Time 16 bits
- Forward Delay 16 bits
-
Default Timers
-
Hello
- 2s
-
Forward Delay
- 15s
-
Max Age
- 20s
-
Path Selection
-
1
- Bridge with lowest root ID becomes the root
-
2
- Prefer the neighbor with the lowest cost to root
-
3
- Prefer the neighbor with the lowest bridge ID
-
4
- Prefer the lowest sender port ID
-
STP Configuration
-
PVST & PVST+ Configuration
-
Enable STP.
- Switch(config)# spanning-tree <vlan-id>
-
Set bridge priority.
- Switch(config)# spanning-tree vlan <vlan-id> priority <bridge-priority>
-
Set root bridge (macro).
- Switch(config)# spanning-tree vlan vlan-id root {primary | secondary} [diameter diameter]
-
Set port cost.
- Switch(config-if)# spanning-tree [vlan vlan-id] cost cost
-
Set port priority.
- Switch(config-if)# spanning-tree [vlan vlan-id] port-priority port-priority
-
Set STP timers.
- Switch(config)# spanning-tree [vlan vlan-id] hello-time seconds
- Switch(config)# spanning-tree [vlan vlan-id] forward-time seconds
- Switch(config)# spanning-tree [vlan vlan-id] max-age seconds
-
RSTP Configuration
-
Define an edge port.
- Switch(config-if)# spanning-tree portfast
-
Override a port type.
- Switch(config-if)# spanning-tree link-type point-to-point
-
MST Configuration
-
Enable MST on a switch.
- Switch(config)# spanning-tree mode mst
-
Enter MST configuration mode.
- Switch(config)# spanning-tree mst configuration
-
Name the MST region.
- Switch(config-mst)# name name
-
Set the configuration revision number.
- Switch(config-mst)# revision version
-
STP Feature Configuration
-
Set PortFast on an interface.
- Switch(config-if)# spanning-tree portfast
-
Set UplinkFast on a switch.
- Switch(config)# spanning-tree uplinkfast [max-update-rate pkts-per-second]
-
Set BackboneFast on a switch.
- Switch(config)# spanning-tree backbonefast
-
Enable Root Guard on an interface.
- Switch(config-if)# spanning-tree guard root
-
Enable BPDU Guard
-
globally
- Switch(config)# spanning-tree portfast bpduguard default
-
on an interface
- Switch(config-if)# spanning-tree bpduguard enable
-
Enable Loop Guard
-
globally
- Switch(config)# spanning-tree loopguard default
-
on an interface
- Switch(config-if)# spanning-tree guard loop
-
Enable UDLD
-
globally
- Switch(config)# udld {enable | aggressive | message time seconds}
-
on an interface
- Switch(config-if)# udld {enable | aggressive | disable}
-
Enable BPDU Filter
-
globally
- Switch(config)# spanning-tree bpdufilter default
-
on an interface
- Switch(config-if)# spanning-tree bpdufilter enable
-
STP Troubleshooting
-
Displays STP information about all VLANs
- show spanning-tree
-
Displays STP information about a specific VLAN
- show spanning-tree [vlan {vlan_id}]
-
Displays the STP interface role, cost, port priority, and type for each VLAN on the switch
- show spanning-tree interface interface_type interface_number
-
Displays detailed STP information about an interface, including the number of BPDUs sent and received and the STP features that have been enabled specifically on the interface
- show spanning-tree interface interface_type interface_number detail
-
Displays the MST region name, revision number, and the instance to VLAN mappings
- show spanning-tree mst configuration
-
Displays ports configured with Root Guard that have received superior BPDUs and ports configured with Loop Guard that are in the loop inconsistent state
- show spanning-tree inconsistentports
-
Displays which STP features have been enabled globally on the switch
- show spanning-tree summary
-
STP Features
-
Enhancements
-
PortFast
- Access Layer ports immediately transition to the forwarding state
-
UplinkFast
- Distribution Layer switches maintain backup paths to root bridge. STP only.
-
BackboneFast
- Core Layer switches shorten the expiration of the Max Age timer when an indirect link fails. STP only.
-
Protections
-
BPDU Guard
- Error-disables a port if a BPDU is received
-
Root Guard
- Prevents a port from becoming the root port
-
Loop Guard
- Prevents a blocked port from transitioning to Listening once the Max Age timer has expired
-
BPDU Filter
- Disables STP. Use this feature on Access Layer ports and Routed Ports for security.
-
UDLD
- Unidirectional Link Detection. Detects a one-sided link failure that causes a link to revert to half-duplex mode, fail to receive BPDUs, and potentially cause loops.
-
STP Port States
-
STP
-
Stable
-
Disabled
- Either administratively or err-disabled. Effectively placed in the shutdown state
-
Forwarding
- Learns MAC addresses, forwards frames, and relays BPDUs
-
Blocking
- Does not learn MAC addresses or forward frames. Listens for, but does not relay, BPDUs
-
Transitory
-
Listening
- Does not learn MAC addresses or forward frames. Listens for, but does not relay, BPDUs
-
Learning
- Learns MAC addresses, but does not forward frames. Listens for, but does not relay, BPDUs
-
RSTP
-
Learning
- The port is not forwarding frames yet, but is populating its MAC-address-table
-
Forwarding
- Learns MAC addresses, forwards frames, and relays BPDUs
-
Discarding
- In RSTP, incoming frames are dropped and no MAC addresses are learned.
-
RSTP Port Types
-
Edge
- Connects to a single host; designated by PortFast
-
Shared
- Potentially connects to multiple bridges (half duplex)
-
Point-to-Point
- Connects to exactly one other bridge (full duplex)
-
STP Port Roles
-
STP
-
Designated Port
- One nonroot port selected on a network segment, such that only one switch forwards traffic to and from that segment.
-
Root Port
- A forwarding port that is the best port from non-root bridge to root bridge
-
Disabled Port
- Administratively or err-disabled port
-
RSTP
-
Designated Port
- One nonroot port selected on a network segment, such that only one switch forwards traffic to and from that segment.
-
Root Port
- A forwarding port that is the best port from non-root bridge to root bridge
-
Disabled Port
- Either administratively or err-disabled. Effectively placed in the shutdown state
-
Backup Port
- a port that provides a redundant (but less desirable) connection to a segment where another switch port already connects.
-
Alternate Port
- a port other than the root port that has an alternative path to the root bridge.
-
STP Modes
-
PVST
- Per-VLAN Spanning Tree
-
RPVST
- Rapid Per-VLAN Spanning Tree
-
MST
- Multiple Instance Spanning Tree
-
STP Standards
-
IEEE
- IEEE 802.1D-1998 · Deprecated legacy STP standard
- IEEE 802.1w · Introduced RSTP
- IEEE 802.1D-2004 · Replaced legacy STP with RSTP
- IEEE 802.1s · Introduced MST
- IEEE 802.1Q-2003 · Added MST to 802.1Q
- IEEE 802.1Q-2005 · Most recent 802.1Q revision
-
Cisco
- PVST · Per-VLAN implementation of legacy STP
- PVST+ · Added 802.1Q trunking to PVST
- RPVST+ · Per-VLAN implementation of RSTP