Module 5 notes

MODULE 5 - SPANNING TREE PROTOCOL (STP)

5.1 - PURPOSE OF STP

STP (Spanning Tree Protocol): A Layer 2 protocol that prevents switching loops while allowing redundant network connections. Original standard: IEEE 802.1D.

Redundancy: Having multiple network paths to prevent a single point of failure.

Layer 2 Loop: Occurs when Ethernet frames circulate endlessly between switches because multiple active paths exist without loop prevention.

Problems caused by Layer 2 loops:

- Broadcast storms

- MAC address table instability (MAC flapping)

- Link saturation and high CPU utilization

- Network slowdowns or outages

Why Layer 2 loops persist: Ethernet frames have no TTL or Hop Limit. IPv4 uses TTL and IPv6 uses Hop Limit to prevent indefinite Layer 3 forwarding.

Broadcast Storm: Excessive broadcast traffic that overwhelms switches and connected devices. Can result from Layer 2 loops or faulty network hardware.

Unknown Unicast: A frame whose destination MAC address is not in the switch MAC address table. The switch floods it out other ports in the same VLAN, potentially contributing to loops.

Spanning Tree Algorithm (STA): Algorithm developed by Radia Perlman that selects one root bridge and creates a loop-free network by blocking redundant paths.

STP behavior:

1. Select a root bridge.

2. Determine the best paths to the root.

3. Block redundant paths.

4. Recalculate and unblock needed paths when a link fails.

5.2 - STP OPERATIONS

Four STP election steps:

1. Elect the root bridge.

2. Elect root ports.

3. Elect designated ports.

4. Identify alternate (blocked) ports.

BPDU (Bridge Protocol Data Unit): Control frame exchanged by switches to share STP information and determine the root bridge and port roles.

Bridge ID (BID): Identifies a switch in STP. Includes bridge priority, extended system ID (VLAN ID), and MAC address.

Default Bridge Priority: 32768.

Priority Range: 0 to 61440, in increments of 4096.

Extended System ID: Adds the VLAN ID to the bridge priority for the displayed BID priority value.

Example: 32768 + VLAN 1 = 32769.

Root Bridge: The switch with the lowest BID. It serves as the reference point for STP path calculations.

Root Bridge Election:

1. Lowest bridge priority wins.

2. If equal, lowest MAC address wins.

Switches exchange BPDUs to agree on the root bridge. Administrators can lower priority to select a preferred root.

Root Path Cost: Total cost of the links along a path to the root bridge. STP prefers the lowest total cost.

Default Short Path Costs (IEEE 802.1D):

10 Mbps = 100

100 Mbps = 19

1 Gbps = 4

10 Gbps = 2

Long Path Costs (IEEE 802.1w):

10 Mbps = 2,000,000

100 Mbps = 200,000

1 Gbps = 20,000

10 Gbps = 2,000

Root Port (RP): The single port on each non-root switch that provides the lowest-cost path to the root bridge. Root bridges do not have root ports.

Example: A direct 100 Mbps link costs 19. Two 100 Mbps links cost 38. STP chooses the direct path with cost 19.

Designated Port (DP): The port selected to forward traffic on a network segment. The port advertising the best path to the root is designated. All active ports on the root bridge are designated ports.

Alternate Port: Backup port that is blocked/discarding to prevent loops and can become active if the preferred path fails.

Equal-Cost Root Port Tie-Breakers:

1. Lowest sender BID.

2. Lowest sender port priority.

3. Lowest sender port ID.

These are used after comparing root path costs.

STP Timers:

Hello Timer = 2 seconds (range 1-10).

Forward Delay = 15 seconds per listening/learning state (range 4-30).

Max Age = 20 seconds (range 6-40).

Root bridge controls STP timer values for the topology.

Recommended maximum STP diameter with default timers = 7 switches.

Classic STP Port States:

Blocking: Receives BPDUs; no MAC learning or data forwarding.

Listening: Sends/receives BPDUs; no MAC learning or data forwarding.

Learning: Sends/receives BPDUs and learns MAC addresses; no data forwarding.

Forwarding: Sends/receives BPDUs, learns MAC addresses, and forwards data.

Disabled: Administratively disabled; no BPDU exchange, MAC learning, or forwarding.

Classic STP Transition:

Blocking -> Listening (15 seconds) -> Learning (15 seconds) -> Forwarding.

Listening and learning create a typical 30-second forwarding delay.

PVST (Per-VLAN Spanning Tree): Runs a separate STP instance for each VLAN, allowing different root bridges and forwarding paths per VLAN.

5.3 - STP EVOLUTION AND FEATURES

STP / CST: Original IEEE 802.1D spanning tree, using one common spanning tree instance for the bridged network.

PVST+: Cisco enhancement that runs a separate traditional STP instance for each VLAN.

RSTP (Rapid Spanning Tree Protocol): IEEE 802.1w, a faster-converging evolution of STP that retains backward compatibility. Can reconverge in milliseconds under suitable conditions.

Rapid PVST+: Cisco implementation of RSTP that runs a separate rapid spanning tree instance for each VLAN.

MSTP (Multiple Spanning Tree Protocol): Maps multiple VLANs into shared spanning tree instances to reduce the number of separate calculations.

MST: Cisco implementation of multiple spanning tree, supporting up to 16 MST instances in the described implementation.

PortFast: Allows an end-device access port to transition immediately to forwarding, bypassing the classic listening and learning delay. Helps DHCP clients obtain addresses without waiting 30 seconds. Use only on ports connected to end devices.

BPDU Guard: Protects PortFast-enabled/access ports by placing the interface into err-disabled state if a BPDU is received. Prevents accidental switch connections from creating loops. Recovery requires administrator action or configured error-recovery behavior.

Alternatives to STP:

MLAG = Multi System Link Aggregation.

SPB = Shortest Path Bridging.

TRILL = Transparent Interconnection of Lots of Links.

Hierarchical Network Layers:

Access: Connects end devices.

Distribution: Aggregates access switches and commonly provides routing and policy control.

Core: High-speed backbone connecting network sections.

Collapsed Core: Combines core and distribution functions.

KEY FACTS TO MEMORIZE

STP = IEEE 802.1D.

RSTP = IEEE 802.1w.

Default bridge priority = 32768.

Lowest BID wins root election.

Lowest path cost wins root port election.

Hello = 2 seconds.

Forward Delay = 15 seconds.

Max Age = 20 seconds.

Classic listening + learning = 30 seconds.

100 Mbps cost = 19 (short method).

1 Gbps cost = 4 (short method).

10 Gbps cost = 2 (short method).

PortFast = Immediate forwarding for end devices.

BPDU Guard = Err-disables a guarded port upon receiving a BPDU.

PVST+ = One STP instance per VLAN.

Rapid PVST+ = One RSTP instance per VLAN.