Spanning Tree Protocol (802.1D)

Bridge Protocol Data Unit (BPDU):

  • Configuration BPDU - Sent by root towards downstream switches. Sends timer information
  • Topology Change Notification (TCN) - Sent by downstream switches when something changes. Acked with a configuration BPDU with TCP Ack bit set
  • Sent to well-known STP multicast 00:19:06:ea:b8:80

Timers

  • Hello time: 2 seconds
  • Forward delay: 15 seconds
  • Max Age: 20 seconds (Time that a switch stores BPDU before discarding it. If no update, assumes topology change has occured [indirect failure]).

Selecting a Root Bridge

Must select: - One root bridge - One root per per nonroot bridge - One designated port per network segment

Selects based on: - Lowest root bridge ID (BID). - Lowest path cost to the root. - Lowest sender bridge ID - Lowest sender port ID

All non-root and non-designated ports are blocked

Default bridge priority is 32768 (0-65535)

Port priority default is 128. Hex value combination of port priority (128) plus port (21) [ 0x8105 ]

Link costs:

Bandwidth Cost
10 Mbps 100
100 Mbps 19
1 Gbps 4
10 Gbps 2
20+ Gbps 1

Adds path cost of received port to the path cost in the received BPDU from its neighbor

STP-Sample-Topology

STP States

State Timer Action
Disabled N/A Cannot send or receive data
Blocking Max Age (20 sec) Discards frames. Does not learn, receives BPDUs
Listening Forward Delay (15 sec) Discards frames. Does not learn, receives BPDUs to determine role in network
Learning Forward Delay (15 sec) Discards frames, learns MAC addresses, Rx/Tx BPDUs
Forwarding N/A Accepts frames, learns MACs, Rx/Tx BPDUs

Types of Spanning Tree

Type Description
Common Spanning Tree (CST) Single instance for all VLANs. 802.1D. CST BPDUs sent on native VLAN.
PVST+ Per-VLAN STP.

STP-Flavors

STP Enhancements

Name Description
Portfast Skip listening/learning on access ports. No TCN BPDU sent.
UplinkFast Backup for root ports. Not configured on root bridge. State is "Alternate" on candidate root ports.
BackboneFast Immediate expiration of max age timer in event of indirect link failure. Inferior BPDU received from designated bridge on segment. RLQ (Root Link Query) sent.

STP Protection

Name Description
Root Guard Prevents a port from becoming root port
BPDU Guard Puts portfast ports in errdisable if receives a BPDU
Loop Guard Blocks ports that stop receiving BPDUs to prevent loops (loop inconsistent state)
BPDU Filter Blocks BPDUs on interface (disables STP). Does not send/receive BPDUs

Miscellaneous Notes

  • spanning-tree extended system-id sets last 12 bits of 16-bit bridge priority to VLAN identifier (32768 + 2405 [VLAN] = 35173)
  • "diameter" auto-configures STP timers. Default 7 (Cisco). Correlates to number of switches traversed in L2 topology

RSTP (802.1w)

  • spanning-tree mode rapid-pvst
  • Note if 802.1W capable switch receives 802.1D BPDU, will operate at 802.1D
  • BPDU originated by each switch even if it does not receive a BPDU on its root port (802.1D spanning tree)
  • RSTP detects a topology change only when a nonedge port transitions to the forwarding state

RSTP Timers

  • 3 missed BPDUs (2 second) = neighbor down (6 seconds). No max-age.

RSTP Port States

Type Description
Root Same as STP
Designated Same as STP
Alternate Backup to the root port
Backup Backup to the designated port
Disabled Not used in spanning tree

RSTP Port Types

Type Description
Edge Connected to end-user (portfast). Loses edge status if receives BPDU.
Point-to-Point Any port that connects to another switch and becomes a designated port. Full duplex.
Shared Connects to multiple bridges. Half duplex

RSTP States

State Action
Disabled Cannot send or receive data
Discarding Blocking
Learning Same as STP
Forwarding Same as STP

Multiple Spanning Tree Protocol (802.1s)

(config)# spanning-tree mode mst
(config)# spanning-tree mst configuration
(config-mst)# name region_name
(config-mst)# revision number
(config-mst)# instance number vlan vlan_range
(config-mst)# end
# show spanning-tree mst
  • Maps a group of VLANs to an instance (16 per region [Cisco])
  • IST (internal) - runs within each region
  • CST (external) - runs outside each region

Parameters

  • Configuration name (32 chars)
  • Revision number (0 to 65535)
  • Instance to VLAN mapping (4096 entries)

IST (internal spanning tree)

  • A Region (usually 1) contains switches running MST with same compatible parameters
  • Instance-to-VLAN mapping not sent in BPDU (configured locally)
  • IST instance is locally significat bounded by the edges of the region:

mst-cst

Common Internal Spanning Tree

  • MST Region is regarded as a black box to CST

mstp-topology-1

  • CIST Root has lowest Bridge ID among ALL regions

MSTP Deep-dive

Sample packet captures

STP BPDU:

stp-bpdu

RSTP BPDU:

rstp-bpdu

RSTP BPDU (TC):

rstp-bpdu-tc