Spannig tree protocol

https://www.ciscopress.com/articles/article.asp?p=2832407&seqNum=6

play-sharp-fill

STP Overview

Spanning Tree Protocol

Types of STP
– Original STP
– STP / 802.1D
– PVST+
– Cisco improvement adding a per VLAN feature
– Cisco default
– RSTP / 802.1w
– Improved STP with much faster convergence
– Rapid PVST+
– Cisco improvement of RSTP adding per VLAN feature
– Makes a large network more efficient

Why STP?
– STP is used to prevent loops when using redundant switches
– Broadcast messages are sent all the time and Broadcast Storms are easy to trigger
– Loops also cause unstable MAC address tables because they’re constantly being changed/updated
– Duplicate frames are being sent to the same host

How STP Works
– Switches in a loop ‚drop‘ one of the ports
– Switch with the blocked port still receives the data but it ignores it
– Simple but how the switches choose the port to block can be tricky

Choosing the blocked port
– 1) Elect a root bridge
– King of switches
– 2) Place root bridge interfaces into a Forwarding state
– 3) Each non-root switch selects its Root Port
– This is the best route to the bridge
– 4) Remaining links choose a Designated Port
– 5) All other ports are put into a Blocking state

Roles
– Root Ports
– The best port to reach the Root Bridge
– Designated Port
– Port with the best route to the Root Bridge on a link
– Non-Designated Ports
– All other ports that are in a blocking state

States
– Disabled
– Port that is shutdown
– Blocking
– A port that is blocking traffic
– Must move to Listening state before moving to Forwarding
– Listening
– Not forwarding traffic and not learning MAC addresses
– Transitional State while changing from 1 role to another
– Held in this state for the Forward Delay timer (15 sec default)
– Learning
– Not forwarding traffic but learning MAC addresses
– Transitional State while changing from 1 role to another
– Held in this state for the Forward Delay timer (15 sec default)
– After this, the port can now move to a Forwarding state
– Forwarding
– Sending and receiving traffic like normal
– Can move directly to Blocking

Root Bridge Election
– Each switch has a BPDU. BPDU contains:
– Root Cost
– Cost of the root bridge
– BID (Bridge ID)
– The switch with the lowest overall BID will become the root bridge
– They look something like: 32769aaaa:aaaa:aaaa
– BID is made up of:
– STP priority
– Default value of 32768 + VLAN number
– For VLAN 1, the STP priority would be 32769
– MAC Address
– Each switch thinks it should be the root bridge
– They share their BPDUs with each other
– Once they all agree, the root bridge has been elected
– All ports on the root bridge enter a Forwarding State
– Each non-root switch will now choose the best path to the root bridge
– This is the Root Port
– This is based on Port Cost
– Cost is based on port speed
– Better speed, lower cost
– Each outgoing port to the root added together
– Can be set manually
– If a tie happens, they look at lowest neighbor BID
– If they tie, they use lowest neighbor port priority
– If they tie, lowest neighbor port number
– Select a Designated Port
– Look at lowest root cost to the bridge
– If that ties, lowest BID
– If that ties, lowest neighbor port priority
– If that ties, lowest neighbor port number
– Every port that is not a root port of designated port is put in a Blocking State

Downfall of STP — Convergence
– The time it takes to do the work and become stable

Timers – Default (RSTP addresses the delay of convergence)
– Hello
– Every 2 seconds
– Lets everyone know everything is still alive
– MaxAge
– 10x Hello timer by default (20 seconds)
– The time the switch will wait before it realizes something is wrong
– Forward Delay
– 15 seconds
– The time between the Listening and Learning state