STP Flashcards
Why we have STP
Layer 2 ethernet headers do not have a TTL field to stop looping traffic
STP is used to prevent layer 2 loops
Necessary evil - Access layer switches can only use half of their physically cabled uplink bandwidth, but it’s for the sake of preventing broadcast storms which will crash a network
Bridges vs. Switches
Bridges:
Early switches that were expensive and had very few ports
They segmented LANs which were built with hubs
Switches:
A multi-port bridge
STP was invented when bridges were in uses
So it uses “Root Bridge” and “Bridge Protocol Data Units”
How STP Works
Enabled by default on all vendor’s switches
Switches send BPDUs when they come online
Used to detect other switches & potential loops
Switch will not forward traffic out any port until it is certain it is loop free
Port States
Blocking State:
When the port first comes online, it will be in a blocking state
STP will detect if the port forms a potential loop
Forwarding State:
If there is no loop, the port will transition to Forwarding
Can take up to 50 seconds
Bridge ID
The BPDU contains the switch’s BID, which uniquely identifies the switch on the LAN
The BID is comprised of the switch’s unique MAC address & an administrator defined Bridge Priority value
The Bridge Priority can be from 0 - 65535, with 32768 being the default
Root Bridge
Elected based on the switches’ BID values
The switch with the lowest Bridge Priority value is preferred
In the case of a tie, the switch with the lowest MAC address is selected
The switches build a loop-free forwarding path tree leading back to the Root Bridge
Root Port
Each switch’s exit interface on the lowest cost path to the Root Bridge is selected as its Root Port
STP: Load Balancing
STP does not do load balancing
If a switch has multiple equal cost paths towards the Root Bridge:
It will select the neighbor switch with the lowest BID
If a switch has multiple equal cost paths via the same neighbor switch towards the Root Bridge:
It will select the port with the lowest Port ID
Designated Ports
Ports on the neighbor switch opposite the Root Port are Designated Ports
Root ports = point towards the Root Bridge
Designated ports = point away from Root Bridge
All ports on the Root Bridge are always Designated Ports
Blocking Ports
Any ports which have not been selected as a Root/Designated Port would potentially form a loop
These are selected as Blocking Ports
STP only blocks ports on one side of the blocked link
BPDUs continue to be sent over the link but other traffic is dropped
How to tell which are root/designated/blocking ports
Determine the Root Bridge first (best BID)
All ports on the Root Bridge are Designated
Determine the Root Ports on the other switches (lowest cost to Root Bridge)
The ports on the other sides of those links are Designated ports
On the links which are left, one port will be Blocking
Determine the blocking port (highest cost path to Root Bridge or highest BID)
The ports on the other sides of those links are Designated ports
Spanning Tree Versions: IEEE Open Standards
802.1D STP (Spanning Tree Protocol):
The OG STP
Uses one STP for all VLANs in the LAN
802.1w RSTP (Rapid Spanning Tree Protocol):
Significantly improved convergence time
Uses one STP for all VLANs in the LAN
802.1s MSTP (Multiple Spanning Tree Protocol):
Enables grouping & mapping VLANs into different spanning tree instances for load balancing
Spanning Tree Versions: Cisco Proprietary
PVST+ (Per VLAN Spanning Tree Plus):
Cisco enhancement to 802.1D
Uses a separate Spanning tree instance for every VLAN
Default on Cisco switches
Will assign Root, Designated, or Alternate role to ports
Alternate ports = blocking ports
RPVST+ (Rapid Per VLAN Spanning Tree Plus):
Significantly improved convergence time over PVST+
Uses a separate Spanning tree instance for every VLAN
Cisco versions do not support grouping multiple VLANs into the same instance
Command: Verify spanning tree info
show spanning-tree –> displays STP info for all VLANs
show spanning-tree vlan 1 –> specify which VLAN to show STP info on
show mac address-table –> Helps you verify the path a packet takes by looking at the MAC address of the destination, then checking each hop’s MAC table from the starting point to see which interface it leaves out of
Root Bridge Election
Because Spanning Tree selects path pointing towards the root bridge, it acts as the center point of the LAN
Best practice is to ensure a pair of high-end core switches are selected as the first & second most preferred Root Bridge