Thebitbucket - co.Uk-Spanning Tree Protocol Topic Notes
Thebitbucket - co.Uk-Spanning Tree Protocol Topic Notes
thebitbucket.co.uk/ccie/topic-notes/switching/spanning-tree-protocol-topic-notes/
STP Topology
STP Topology
Process to build the STP topology:
Elect a Root Bridge
Elect Non-Root Bridges Root ports
Elect Designated ports
1/25
Configuration BPDUs Topology Change Notification BPDUs
Sending 8 SBID
Bridge ID
Bridge ID (BID)
Bridge ID
Original 802.1d format Bridge ID
Priority System ID
2 Bytes 6 Bytes
3/25
Bridge ID consists of:
Bridge Priority
Value of 0 – 61440
Set in increments of 4096
Default is 32768
Lower value is preferred
4 bits
System ID Extension
Value of 0 – 4095
VLAN ID
12 Bits
MAC Address
6 Bytes (48 bits)
Root Bridge
STP Root Bridge
Used as a reference point for other Non-Root Bridges to determine path
Only a single Root Bridge is elected in Layer 2 network
Only the Root Bridge Generates BPDUs
All other bridges forward them on
Root Bridge sets timers
All other bridges use these timer settings
Can set manually on NON-Root bridges but unless that switch becomes the
Root Bridge, the timers are ignored
Timers include:
Hello timer
Fordwarding Delay timer
Max_Age timer
In the above diagram, all priorities being equal, SW1 will become the Root Bridge as
it has the lowest MAC address,
Therefore the lowest Bridge ID
Process:
1. Each Non-Root Bridge adds the local port cost to the Root Path Cost (RPC) of
received BPDUs
2. Lowest or superior RPC is now set to Root Port
3. Hellos received on Root Port are forwarded through Designated Ports
1. Updates RPC, Sender Bridge ID, Sender Port ID and MessageAge
5/25
2. Hellos received on other ports of Non-Root Bridge are processed but not
forwarded
4. Do not forward Hellos out Root Ports or blocking ports
Selection:
Prefer neighbor advertising lowest cost to root (RPC)
Equal cost tie breakers:
1. Prefer neighbor with lowest Bridge ID (BID)
2. Prefer the lowest Sender Port ID (SPID)
1. Default value is 128 + port number
1. 1st port will be 128.1
2. 20th port will be 128.20 etc
6/25
Figure 3 – Port Priority used for tie-breaker
7/25
Figure 5 – Port Role Allocation in 3 Switch Topology
STP Timers
Spanning Tree Timers
3 main timers are used by Spanning Tree
Hello timer
Default is 2 seconds
Time between each BPDU sent on port
Originated by Root Bridge
8/25
Sent out all DP
Received on all RP
Can be configured manually on Root Bridge only
Command:
(config)#spanning-tree vlan <vlan-id> hello-time <1-10
seconds>
Forward Delay timer
Default of 15 seconds
Time to spend in Listening and Learning port states
Can be configured manually on Root Bridge only
Command:
(config)#spanning-tree vlan <vlan-id> forward-time <4-30
seconds>
Max Age timer
Default of 20 seconds
Length of time to wait before initiating a topology change if stops
receiving Hllo BPDUs
Can be configured manually on Root Bridge only
Command:
(config)#spanning-tree vlan <vlan-id> max-age <6-40>
9/25
Figure 6 – STP Topology Change Process
10/25
Default Costs
802.1D-1998 802.1D-2004
100Mbps 19 200000
1Gbps 4 20000
10Gbps 2 2000
STP Modes
1. Root Port
Forwarding state
Only on Non-Root Bridges
Only single port towards Root Bridge
Forwards traffic to Root Bridge
2. Designated Port
Forwarding state
On Root and Non-Root Bridges
11/25
Ports facing away from Root Bridge
Receives traffic going towards Root
On Root Bridge all ports are Designated
3. Non-Designated Port
Blocking state
Only on Non-Root Bridges
Receives BPDUs
Discards all other traffic
Unable to send traffic
4. Disabled
Shutdown port
Doesn’t participate in STP
As all priorities are equal and MAC addresses will be the same for both links,
the selection is made on Port priority which is 128 plus the port number.
Lower value is preferred
1. Blocking
Receives BPDUs to determine location of Root Bridge
Would cause a loop if active
Time in state set by MaxAge timer
Default 20 seconds
2. Listening
Receives and transmits BPDUs
Doesn’t populate MAC table
Doesn’t forward frames
Time in state set by Forward Delay timer
Default 15 seconds
3. Learning
Prepares to participate in forwarding
Doesn’t forward frames
Populates CAM table
Time in state set by Forward Delay time
Default 15 seconds
4. Forwarding
Considered part of the active topology
Populates CAM table
Sends and receives BPDUs
Forwards frames
5. Disabled
Doesn’t participate in STP
Doesn’t forward frames
Ports are put into Designated Blocking state until they receive BPDU from
counterpart
Non-Edge Ports
Default port type on Cisco switches
Point-to-Point
Full Duplex
Single RSTP switch connection
Shared
Half Duplex
Multiple RSTP switch connections
RSTP Re-convergence
RSTP Re-convergence
Needs to re-converge if Root port is lost
If there is an Alternate port, it is selected in its place
New Root port then synchronised with downstream bridges
Same functionality as Uplinkfast
If there is no Alternate port and no better information available
Declare local bridge as Root bridge
Synchronise decision
Adapt to better information
Keep topology as small as possible
RSTP suffers from count-to-infinity depending on scale of design
Multiple Spanning-Tree
802.1S standard
Convergence a lot quicker than PVST+
Backward compatible with
802.1D (CST)
802.1W (RSTP)
Inherits all RSTP functionality
If doesn’t hear response from other bridges in MST, falls back to legacy protocol
Displayed as port type P2P Bound (STP)
CIST (Common and Internal Spanning Tree) Root must be within MST domain
Behaves like inter-region MST
17/25
Maps multiple VLANs to a single Spanning Tree instance
As opposed to 1 instance per VLAN (RSTP) or 1 instance for all VLANs
(CST)
provides better scalability
Decouples VLAN and STP instance
Enables load balancing across multiple paths
MSTP Bridge ID
MSTP Bridge ID
Consists of:
Bridge Priority
4 bits
Increments of 4096
Extended System ID
12 bits
Carries MST instance number instead of VLAN number
MAC Address
6 bytes (48 bits)
MSTP Regions
MSTP Regions
18/25
Figure 9 – MST Regions
20/25
Figure 11 – MST CIST 0 Virtual Bridges
MSTP Configuration
MSTP Configuration
Real configuration would need to start on Root Bridge and work out
Portfast
Portfast
Configures interface type as Edge ports
Transitions directly to forwarding state
Effects TCN generation
Spanning Tree not enabled on these ports
Configured in Global mode:
Enables on all ports unless BPDUs received
Transitions to normal STP port
Command:
(config)#spanning-tree portfast default
Configured in Interface mode
Command:
(config-if)#spanning-tree portfast
(config-if)#spanning-tree portfast trunk
Uplinkfast
UplinkFast
Provides 3 to 5 seconds of convergence after a Root port link failure if alternate port
available
Could potentislly change topology as other switches may avoid uplinkfast switch as
metric set high
Not required with PVRST+ or Rapid Spanning Tree
Command:
(config)#spanning-tree uplinkfast
22/25
BackboneFast
BackboneFast
Cuts convergence time by MAX_AGE for an indirect failure
When receives inferrior BPDU
Needs to be enabled everywhere
Not required with PVRST+
Command:
(config)#spanning-tree backbonefast
BPDU Guard
BPDU Guard
Shuts down port if BPDU received
Configured in Global mode
Command:
(config)#spanning-tree portfast bpduguard default
Configured in Interface mode
Command:
(config-if)#spanning-tree bpduguard enable
BPDU Filter
BPDU Filter
Configured in Global mode
Any Portfast port receiving BPDU becomes a standard port
Command
(config)#spanning-tree portfast bpduguard default
Configured in Interface mode
Ignores BPDUs and doesn’t send any
Command:
(config-if)#spanning-tree bpdufilter enable
Root Guard
RootGuard
If receives superior BPDU than current Root Bridge, port is moved to a Root-
Inconsistent state (STP Listening)
Can not be used at the same time as LoopGuard
LoopGuard does opposite of RootGuard
Configure on downstream Designated ports
Command:
(config-if)#spanning-tree guard root
23/25
Loop Guard
Loop Guard
Similar to UDLD
If link isn’t receiving BPDUs, moves to a Loop-Inconsistent state (STP Blocking)
When receives BPDU, transitions normally
Only monitors Non-Designated ports and prevents them from becoming
Designated
Used on unidirectional links
Can not be used at the same time as RootGuard
RootGuard does opposite of LoopGuard
Configured in Global mode:
Command:
(config)#spanning-tree loopguard default
Configured in Interface mode:
Command:
(config-if)#spanning-tree guard loop
STP UDLD
Flex-Links
Troubleshooting Commands
25/25