Layer 2 redundancy – Spanning Tree Protocol
Lecture 4
SoftUni Team
Technical Trainers
Software University
[Link]
Table of Contents
1. Spanning tree protocol (STP)
2. Rapid STP (RSTP)
3. Per-VLAN STP plus (PVST+)
2
Spanning tree protocol (STP)
What is the Spanning Tree Protocol?
It addresses a problem which
switches can not handle alone:
the broadcast storms
Without STP, a L2 loop will:
Overload the links
Affect the end devices
Cause MAC table instability
…never stop
4
What is the Spanning Tree Protocol? (2)
All STP enabled switches “talk”
to each other
The management information
that they exchange is in the
form of BPDUs
(Bridge Protocol Data Units)
The goal is to logically block
one or more ports to prevent
from loops
5
Why STP is needed?
In this topology STP is NOT
needed
…but there is no
redundancy
6
Why STP is needed? (2)
Now there is a redundancy
…but there is also the loop
problem!
7
The STP algorithm
1. Elect the Root switch (Root bridge)
This is the switch with the lowest BID (Bridge ID)
BID = Switch Priority and MAC
2. Select the root ports
They have the best cost (lowest) to the Root
Selected per switch
3. Select the designated ports
They have the best cost (lowest) to the Root
Selected per segment (connection)
4. All other ports go to blocking state 8
STP tie-breakers
If there is a tie situation - the same path cost via different
paths, use the following tie-breakers:
When selecting Root port or Designated port, chose the
neighboring switch which has the lowest Bridge ID
If the Bridge ID is the same, select the lowest Port ID (PID)
Port ID = Port priority and port number
9
Link costs (path cost)
Higher port speed ->
lower cost
The values can be changed
by administrator
10
STP Priority
A number between 0 and 61440
Must be configured in increments of 4096
Default is 32768 (+ the VLAN ID)
The switch with the lowest priority will become the Root
If equal values -> lowest MAC address wins
(BID = Priority and MAC)
11
STP Priority (2)
16 bits reserved for bridge priority initially
Only the first 4 are now used for priority and the other 12 are
for VLAN
12
STP Priority (3)
Extended system ID is the reason for the 4096 increments
13
STP Example 1
Priority 32768 Priority 4096
Priority 0
All links have the same cost 14
STP Example 2
Find the Root, the RP, the DP and the Blocking ports
Rp Fa0/1 Dp Fa0/1 Root
Fa0/2 Dp
Dp Fa0/3 Dp Fa0/2
Fa0/3
Dp
Fa0/1
Fa0/2 Fa0/2
Fa0/1 Rp Rp
Fa0/3
Fa0/3
Dp
15
STP Example 3
Find the Root, the RP, the DP and the Blocking ports
Root
Dp Dp
fa0/1 fa0/2
fa0/1 fa0/1
Rp Rp
Dp Dp
fa0/2 Rp fa0/2
Dp Dp
Rp
16
Rapid STP (RSTP)
Spanning Tree Protocol – Main Flavors
STP - Spanning Tree Protocol, IEEE 802.1D
RSTP - Rapid STP, IEEE 802.1W
MSTP - Multiple STP, IEEE 802.1S (802.1Q-2005)
PVST+ - Per-VLAN STP, Cisco proprietary
18
STP (the good old Spanning Tree)
Spanning Tree Protocol
The industry standard name is IEEE 802.1D
Slow convergence
Port states:
Disabled
Blocking (up to 20 sec)
Listening (up to 15 sec)
Learning (up to 15 sec)
Forwarding 19
RSTP (the faster STP)
Rapid STP
The industry standard name is IEEE 802.1W
Much faster convergence than STP
Introducing Edge port – a port which is connected to an end device
RSTP uses the same algorithm as STP
Port states:
Discarding
Learning
Forwarding 20
Per-VLAN STP plus (PVST+)
PVST+
Per-VLAN Spanning Tree is Cisco protocol
Why? It has a similar idea as MSTP - to distribute the load
Creates a spanning tree topology for each VLAN separately
PortFast in PVST+ is like Edge port in STP/RSTP
22
PVST+ (2)
23
PVST+ (3)
Priority: 0 Priority: 4096 Priority: 4096 Priority: 0
Vlan 1 Vlan 2 Vlan 1 Vlan 2
Switch 1 port 1 Switch 2
port 1
R R
port 2 port 2
port 1 port 2
Switch 3
Priority: 32768 Priority: 32768
Vlan 1 Vlan 2
24
The good and the bad about PVST+
PVST+ advantages:
triggers STP calculation only if there is a potential loop in a
particular VLAN
detailed “look” of the network – does not block ports when
there is no loop on the trunks for a given VLAN
PVST+ disadvantages
generates a lot of overhead in the network
proprietary protocol
25
Demonstration
Summary
1. … tree protocol (STP)
Spanning
2. Rapid
… STP (RSTP)
3. Per-VLAN STP plus (PVST+)
…
27
Questions?
SoftUni Diamond Partners
Educational Partners
30
Trainings @ Software University (SoftUni)
Software University – High-Quality Education,
Profession and Job for Software Developers
[Link], [Link]
Software University Foundation
[Link]
Software University @ Facebook
[Link]/SoftwareUniversity
Software University Forums
[Link]
3