CCNP Study Notes – Traditonal Spanning Tree Protocol

By | March 4, 2012

Overview

  • defined in IEEE 802.1D.
  • provides network link redundancy, so that a layer 2 switched network can recover from failures without intervention in a timely manner.
  • solves the problem of bridging loops (forwarding a single frame around and around between two switches)
  • enables switches to become aware of each other in order to negotiate a loop-free path through the network
  • communicated among all connected switches
  • algorithm executed based on info received from other switches
  • switch calculates all the redundant paths to a reference point (Root Bridge)
  • switch picks the best path to the root bridge, and then disables/blocks forwarding on the other paths
  • computes a tree structure that spans all switches in a subnet or network
  • STP algorithm is recalculated if a forwarding port fails or becomes disconnected, so another port can begin forwarding

Bridge Protocol Data Units (BPDU’s)

  • BPDU frames sent out a port using the MAC address of the port itself as a source address
  • frames sent to STP multicast MAC address 01-80-c2-00-00-00 as the switch is unaware of the other switches around it
  • 2 types of BPDU
    • configuration BPDU  – used for STP computation
    • topology change notification (TCN) BPDU  – announces changes to the network topology
  • sent out every switch port, every 2 seconds by default

Electing A Root Bridge

  • election process takes place amongst all connected switches
  • lowest bridge ID = Root Bridge
  • Bridge ID consists of:
    • bridge priority (2 bytes) – value can be 0-65535, default is 32768 (or 0x8000)
    • MAC address (6 bytes – can come from the supervisor, backplane, or a pool of 1024 addresses that are assigned to every supervisor or back plane
  • if switches have the same bridge priority then lowest MAC determines root bridge
  • on boot up a switch assumes it is the root bridge
  • each switch starts by sending out BPDU’s with the root bridge = it’s own bridge ID, and a sender bridge ID
  • once elected only the RB can send out configuration BPDU’s, all other switches forward or relay them adding their own sender bridge ID’s
  • switch learns of a better RB and then replaces it’s own RD ID with the one announced in the BPDU
  • election is an on-going process, triggered by RB ID changes in BPDU’s every 2 seconds

Electing Root Ports

  • each non-root switch must select one root port
  • port with lowest root path cost wins
  • root ports always point to the root bridge
  • port is selected by calculating the root path cost , which is the cumulative cost of all the links leading to to the root bridge
  • root path cost is modified as it travels along the links to give the cumulative cost
  • higher bandwidth = lower cost

 

Link Bandwidth STP Cost
4 Mbps 250
10 Mbps 100
16 Mbps 62
45 Mbps 39
100 Mbps 19
155 Mbps 14
622 Mbps 6
1 Gbps 4
10 Gbps 2

 

  • root bridge send out BPDU with a root path cost of 0, because it’s ports are on the root bridge
  • next closest neighbour receives BPDU, adds the path cost of it’s own port where the BPDU arrived, as the BPDU is received
  • the neighbour sends out BPDU’s with new cumulative value as the root path cost
  • root path cost is incremented by the ingress port path cost as the BPDU is received at each at each switch down the line
  • new root path costs are calculated as the BPDU comes in to the switch, not as they go out
  • after incrementing the root path cost, the switch also records the value in memory
  • if BPDU’s come in on other ports, and the calculated root path cost is lower than that already in memory then the new value wins and this port becomes the root port

Electing Designated Ports

  • each switch elects one designated port per network segment
  • this port is the only one that forwards traffic to and from the segment
  • decision based on lowest cumulative root path cost to the root bridge
  • if switch receives a BPDU from a neighbour announcing a lower root path cost than it’s own then it assumes the neighbour has the designated port for that segment
  • if a switch only receives BPDU’s on a port announcing a higher root path cost then it assumes that it has the designated port for that segment

 

Where there are ties in STP calculations, the following conditions are evaluated:

  1. lowest root bridge ID
  2. lowest root path cost to root bridge
  3. lowest sender bridge ID
  4. lowest sender port ID

 

STP Timers – can be configured at the CLI, but only on the root bridge if required

 

Hello Time

  • Interval between configuration BPDU’s sent by the root bride.
  • non root switches use this as defined on the root bridge as they just relay BPDU’s sent by the root bridge
  • all switches also have a locally configured hello time for timing of TCN BPDU’s
  • default is 2 seconds

Forward Delay

  • time that switch ports spend in both the listening and learning states
  • default 15 seconds

Max Age

  • time a switch stores a BPDU before discarding it
  • each switch keeps a copy of the “best” BPDU it receives, and if it loses contact with the source of the BPDU it assumes a topology change must have occurred after the max age time elapsed, so the BPDU is aged out
  • default 20 seconds

Topology Changes

  • announced in TCN BPDU’s
  • occurs when a switch either moves a port into the forwarding state, or from forwarding or learning to blocking (ie.  switch port up/down)
  • TCN BPDU’d are sent out of the switches root port, so that ultimately the root bridge learns of the change
  • contains no data about the change, only that there has been a change
  • not sent if the port has been configured with Portfast enabled
  • continually sent until acknowledgment from upstream switch is received
  • root bridge receives the TCN BPDU then sends out updated configuration BPDU out to all other switches – done to signal the change but also causes the other switches to shorten their bridge table aging time from the default 300 seconds to the forward delay value (default 15 seconds), meaning the learned MAC addresses are flushed out much sooner than normal, avoiding bridge table curruption
  • Direct Topology Changes – eg. a trunk link goes down
  • Indirect Topology Change – links stay up but something in between as failed or is filtering traffic, so no data including BPDU’s is passing between the two switches
  • Insignificant Topology Changes – eg. a PC is connected to a switch and it’s link goes up or down.  this will cause bridge tables to be flushed out and therefore more flooded frames as MAC’s are learned again.  Use Portfast on access ports to prevent this.

Types of Spanning Tree

  • Common (CST)
    • single instance of STP encompassing all VLAN’s
    • 802.1Q based
    • all CST BPDU’s are transmitted over trunk links using the native VLAN with untagged frames
    • simple configuration, but has limitations such as redundant links being blocked with no capability for load balancing
  • Per VLAN (PVST)
    • cisco proprietary
    • separate instance for each VLAN
    • allows STP to be configured independently on each VLAN
    • allows better performance and tuning
    • makes load balancing possible over redundant links when the links are assigned to different VLAN’s
    • as cisco proprietary it use ISL trunking encapsulation between switches
  • Per VLAN Spanning Tree Plus (PVST+)
    • cisco proprietary
    • allows devices to interoperate with both PVST and CST
    • operates over both 802.1Q and ISL trunks
    • acts as a translator between groups of CST switches and groups of PVST switches

Leave a Reply

Your email address will not be published. Required fields are marked *