1. STP – Spanning Tree Protocol
CIS 187 Multilayer Switched Networks
CCNP SWITCH
Rick Graziani
Spring 2010
2. Follow along with Packet Tracer
Download the following Packet Tracer file from my
web site: PT-Topology-STP.pkt
3. Spanning Tree Protocol (STP)
• “STP often accounts for more
than 50 % of the configuration,
troubleshooting, and
maintenance headaches in real-
world campus networks
(especially if they are poorly
designed).”
• “Complex protocol that is
generally poorly understood.”
• Radia Perlman – Developer of
STP
4. Configuring STP
Switch(config)# spanning-tree vlan vlan-id
Switch(config)# no spanning-tree vlan vlan-id
• By default, STP is enabled for every port on the switch.
• If for some reason STP has been disabled, you can
reenable it.
5. Spanning Tree Protocol (STP)
• IEEE 802.1D
• A loop-prevention protocol
• Allows L2 devices to
communicate with each
other to discover physical
loops in the network.
• Algorithm that creates a
loop-free logical topology.
• STP creates a tree
structure of loop-free
leaves and branches that
spans the entire Layer 2
network.
7. L2 Loops
• Broadcasts and Layer 2
loops can be a dangerous
combination.
• Ethernet frames have no
TTL field IP Packet
• After an Ethernet frame
starts to loop, it will probably
continue until someone
shuts off one of the switches
or breaks a link.
• IP has a mechanism to
prevent loops.
8. L2 Loops
• Bridge loops can occur any
time there is a redundant
path or loop in the bridge
network.
• The switches will flip flop the
MAC address table entries
(creating extremely high
CPU utilization).
• Unicasts, unknown unicasts
and broadcasts are all
problems.
9. STP Prevents Loops
• The purpose of STP is to avoid and eliminate loops in the network by
negotiating a loop-free path through a root bridge.
• STP determines where the are loops and blocks links that are redundant.
• Ensures that there will be only one active path to every destination.
X
10. Spanning Tree Algorithm
• STP executes an algorithm
called Spanning Tree
Algorithm (STA).
– STA chooses a
reference point, called a
root bridge. X
– Then determines the
available paths to that
reference point.
– If more than two paths
exists, STA picks the
best path and blocks the
rest
11. Two-key STP Concepts
• STP calculations make extensive use of two key concepts
in creating a loop-free topology:
– Bridge ID
– Path Cost
Cost (Revised IEEE Cost (Previous IEEE
Link Speed
Spec) Spec)
10 Gbps 2 1
1 Gbps 4 1
100 Mbps 19 10
10 Mbps 100 100
12. Bridge ID (BID)
• Bridge ID (BID) is used to identify each bridge/switch.
• The BID is used in determining the center of the network, in respect to
STP, known as the root bridge.
Bridge ID
Without the
Extended
System ID
Bridge ID with
the Extended
System ID
13. Bridge ID (BID)
• Consists of two components:
– A 2-byte Bridge Priority: Cisco switch defaults to
32,768 or 0x8000.
• Usually expressed in decimal format
– A 6-byte MAC address
• Usually expressed in hexadecimal format.
14. Bridge ID (BID)
• Each switch has a unique BID.
• Original 802.1D standard, the BID = Priority Field +MAC address of
the switch.
– All VLANs were represented by a CST – one spanning tree for all
vlans (later).
• PVST requires that a separate instance of spanning tree run for each
VLAN
– BID field is required to carry VLAN ID (VID).
– Extended system ID to carry a VID.
15. What is the Priority of Access1?
Priority = Priority (Default 32,768) + VLAN
Access1#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.964E.7EBB
Cost 19
Port 5(FastEthernet0/5)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0003.E461.46EC
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
VLAN0010 PVST coming
Spanning tree enabled protocol ieee
Root ID Priority 32778
later…
Address 0001.964E.7EBB
Cost 19
Port 5(FastEthernet0/5)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 0003.E461.46EC
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
16. What is the BID of this switch?
Core# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.964E.7EBB
Cost 4
Port 25(GigabitEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0001.C945.A573
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
17. Bridge ID (BID)
• Used to elect a root bridge (coming)
• Lowest Bridge ID is the root.
• If all devices have the same priority, the bridge with the lowest MAC
address becomes the root bridge. (Yikes)
• Note: For simplicity, in our topologies we will use Bridge Priorities
without the Extended System ID. (Same process, just done per VLAN.)
18. Path Cost – Original Spec (Linear)
Cost (Revised IEEE Cost (Previous IEEE
Link Speed
Spec) Spec)
10 Gbps 2 1
1 Gbps 4 1
100 Mbps 19 10
10 Mbps 100 100
• Bridges use the concept of cost to evaluate how close they are to
other bridges.
• Used to create the loop-free topology .
• Originally, 802.1D defined cost as 1 billion/bandwidth of the link in
Mbps.
– Cost of 10 Mbps link = 100
– Cost of 100 Mbps link = 10
– Cost of 1 Gbps link = 1
• Running out of room for faster switches including 10 Gbps Ethernet
19. Path Cost – Revised Spec (Non-Linear)
Cost (Revised IEEE Cost (Previous IEEE
Link Speed
Spec) Spec)
10 Gbps 2 1
1 Gbps 4 1
100 Mbps 19 10
10 Mbps 100 100
• IEEE modified the most to use a non-linear scale with the new values of:
– 4 Mbps 250 (cost)
– 10 Mbps 100 (cost) • You can change the path cost by
– 16 Mbps 62 (cost) modifying the cost of a port.
– 45 Mbps 39 (cost) • Exercise caution when you do this!
– 100 Mbps 19 (cost) • BID and Path Cost are used to develop
a loop-free topology .
– 155 Mbps 14 (cost)
• Coming very soon!
– 622 Mbps 6 (cost)
– 1 Gbps 4 (cost)
– 10 Gbps 2 (cost)
20. Five-Step STP Decision Sequence
• When creating a loop-free topology, STP always uses the same
five-step decision sequence:
Five-Step decision Sequence
Step 1 - Lowest BID
Step 2 - Lowest Path Cost to Root Bridge
Step 3 - Lowest Sender BID
Step 4 – Lowest Port Priority
Step 5 - Lowest Port ID
• Bridges use Configuration BPDUs during this five-step process.
• We will assume all BPDUs are configuration BPDUs until
otherwise noted.
21. FYI: BPDU key concepts
BPDU key concepts:
• Bridges save a copy of only the best BPDU seen on every port.
• When making this evaluation, it considers all of the BPDUs
received on the port, as well as the BPDU that would be sent on
that port.
• As every BPDU arrives, it is checked against this five-step
sequence to see if it is more attractive (lower in value) than the
existing BPDU saved for that port.
• Only the lowest value BPDU is saved.
• Bridges send configuration BPDUs until a more attractive BPDU
is received.
• Okay, lets see how this is used...
22. Elect one Root Bridge
The STP algorithm uses three simple steps to converge on a loop-
free topology:
STP Convergence
Step 1 Elect one Root Bridge
Step 2 Elect Root Ports
Step 3 Elect Designated Ports
• When the network first starts, all bridges are announcing a
chaotic mix of BPDUs.
• All bridges immediately begin applying the five-step sequence
decision process.
• Switches need to elect a single Root Bridge.
• Switch with the lowest BID wins!
• Note: Many texts refer to the term “highest priority” which is the
“lowest” BID value.
• This is known as the “Root War.”
24. What is the BID of this switch? Who is the Root?
Core# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.964E.7EBB
Cost 4
Port 25(GigabitEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0001.C945.A573
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
• Use this command to view the information on the other four switche.
25. What is the BID of this switch? Who is the Root?
Distribution1# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.964E.7EBB
Cost 19
Port 3(FastEthernet0/3)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0005.5E0D.9315
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
26. What is the BID of this switch? Who is the Root?
Distribution2# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.964E.7EBB
Cost 19
Port 3(FastEthernet0/3)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0060.47B0.5850
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
27. What is the BID of this switch? Who is the Root?
Access1# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.964E.7EBB
Cost 19
Port 5(FastEthernet0/5)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0003.E461.46EC
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
28. What is the BID of this switch? Who is the Root?
Access2# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.964E.7EBB
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0001.964E.7EBB
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
29. Elect one Root Bridge
Lowest BID wins!
My BID is
32768.0001.C945.A573 Who wins?
My BID is My BID is
32768.0005.5E0D.9315 32768.0060.47B0.5850
My BID is My BID is
32768.0003.E461.46EC 32768.0001.964E.7EBB
I win!
33. Root Bridge Selection Criteria
My BID is
32768.0001.C945.A573 I’m Who wins?
the root!
My BID is
My BID is 32768.0060.47B0.5850
32768.0005.5E0D.9315 I’m the root!
I’m the root!
My BID is
My BID is
32768.0003.E461.46EC
32768.0001.964E.7EBB
I’m the root!
I’m the root! I win!
• At the beginning, all bridges assume and declare themselves as the Root
Bridge, by placing its own BID in the Root BID field of the BPDU.
35. • Once all of the switches see that Access2 has the lowest BID, they are
all in agreement that Access2 is the Root Bridge.
Root Bridge
36. Elect Root Ports
I will select
STP Convergence one Root
Step 1 Elect one Root Bridge Port that is
Step 2 Elect Root Ports closest,
Step 3 Elect Designated Ports best path to
the root
bridge.
• Now that the Root War has been won, switches move on to
selecting Root Ports.
• A bridge’s Root Port is the port closest to the Root Bridge.
• Bridges use the cost to determine closeness.
• Every non-Root Bridge will select one Root Port!
• Specifically, bridges track the Root Path Cost, the cumulative
cost of all links to the Root Bridge.
38. • Root Bridge, Access2 sends out BPDUs, containing a Root Path Cost of 0.
• Access1, Distribution1, and Distribution2 receives these BPDUs and adds the Path Cost of
the FastEthernet interface to the Root Path Cost contained in the BPDU.
• Access1, Distribution1, and Distribution2 add Root Path Cost 0 PLUS its Path (port) cost
of 19 = 19.
– This value is used internally and used in BPDUs to other switches.
Path Cost
BPDU BPDU
Cost=0+19=19 Cost=0+19=19
19
19
Root Bridge
0
0
BPDU 19 0 BPDU
Cost=0
Cost=0+19=19
39. Difference b/t Path Cost and Root Path Cost Root Path Cost
Path Cost: • Cumulative cost to the Root Bridge.
• The value assigned to each port. • This is the value transmitted in the BPDU.
• Calculated by adding the receiving port’s Path
• Added to BPDUs received on that port to Cost to the valued contained in the BPDU.
calculate Root Path Cost.
Path Cost
BPDU BPDU
Cost=0+19=19 Cost=0+19=19
19
19
Root Bridge
0
0
BPDU 19 0 BPDU
Cost=0
Cost=0+19=19
40. What are the Path Costs for Root Bridge
Access2?
Path Cost
Access2# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.964E.7EBB
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0001.964E.7EBB
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- -----------------------
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/3 Desg FWD 19 128.3 P2p
Fa0/5 Desg FWD 19 128.5 P2p
41. What are the Path Costs for Distribution1?
Path Cost
Distribution1# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.964E.7EBB
Cost 19
Port 3(FastEthernet0/3)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0005.5E0D.9315
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- ----------------------
Gi0/1 Desg FWD 4 128.25 P2p
Gi0/2 Altn BLK 4 128.26 P2p
Fa0/3 Root FWD 19 128.3 P2p
Fa0/5 Desg FWD 19 128.5 P2p
42. What are the Path Costs for Access1?
Path Cost
Access1# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.964E.7EBB
Cost 19
Port 5(FastEthernet0/5)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0003.E461.46EC
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- ----------------------
Fa0/5 Root FWD 19 128.5 P2p
Gi1/1 Desg FWD 4 128.25 P2p
Gi1/2 Desg FWD 4 128.26 P2p
43. What are the Path Costs for Distribution2?
Path Cost
Distribution2# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.964E.7EBB
Cost 19
Port 3(FastEthernet0/3)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0060.47B0.5850
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- ----------------------
Fa0/3 Root FWD 19 128.3 P2p
Fa0/5 Altn BLK 19 128.5 P2p
Gi0/1 Altn BLK 4 128.25 P2p
Gi0/2 Desg FWD 4 128.26 P2p
44. show spanning-tree detail Path Cost
Use this command to view the
Path Cost of an interface.
Distribution1# show spanning-tree detail
VLAN0001 is executing the ieee compatible Spanning Tree Protocol
Bridge Identifier has priority of 32768, sysid 1, 0005.5E0D.9315
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32769
Root port is 3 (FastEthernet0/3), cost of root path is 19
Topology change flag not set, detected flag not set
Number of topology changes 0 last change occurred 00:00:00 ago
from FastEthernet0/1
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300
45. show spanning-tree detail Path Cost
Use this command to view the
Path Cost of an interface.
Access1# show spanning-tree detail
VLAN0001 is executing the ieee compatible Spanning Tree Protocol
Bridge Identifier has priority of 32768, sysid 1, 0003.E461.46EC
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32769
Root port is 5 (FastEthernet0/5), cost of root path is 19
Topology change flag not set, detected flag not set
Number of topology changes 0 last change occurred 00:00:00 ago
from FastEthernet0/1
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300
46. show spanning-tree detail Path Cost
Use this command to view the
Path Cost of an interface.
Distribution2# show spanning-tree detail
VLAN0001 is executing the ieee compatible Spanning Tree Protocol
Bridge Identifier has priority of 32768, sysid 1, 0060.47B0.5850
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32769
Root port is 3 (FastEthernet0/3), cost of root path is 19
Topology change flag not set, detected flag not set
Number of topology changes 0 last change occurred 00:00:00 ago
from FastEthernet0/1
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300
47. show spanning-tree detail Path Cost
Use this command to view the
Path Cost of an interface.
Access2# show spanning-tree detail
VLAN0001 is executing the ieee compatible Spanning Tree Protocol
Bridge Identifier has priority of 32768, sysid 1, 0001.964E.7EBB
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32769
Topology change flag not set, detected flag not set
Number of topology changes 0 last change occurred 00:00:00 ago
from FastEthernet0/1
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300
No Root port – This switch is the Root Bridge!
48. • Switches now send BPDUs with their Root Path Cost out other interfaces.
• Access 1 uses this value of 19 internally and sends BPDUs with a Root Path Cost of 19
out all other ports. (For simplicity we will not include BPDU to root.)
• Switches receive BPDU and add their path cost.
• Note: STP costs are incremented as BPDUs are received on a port, not as they are sent
out a port.
Path Cost
BPDU
BPDU
Cost=4+19=23
Cost=4+19=23
19
19
BPDU
BPDU
Cost=19 Cost=19 0
0
19 0
Root Bridge
49. • Distribution 1 and Distribution 2 receive the BPDUs from Access 1, and adds the
Path Cost of 4 to those interfaces, giving a Root Path Cost of 23.
• However, both of these switches already have an “internal” Root Path Cost of 19 that
was received on another interface. (Fa0/3 for each with a Root Path Cost of 19.)
• Distribution 1 and Distribution 2 use the better BPDU of 19 when sending out their
BPDUs to other switches.
BPDU
BPDU
Cost=4+19=23
Cost=4+19=23
19
19
BPDU
BPDU
Cost=19 Cost=19 0
0
19 0
Root Bridge
50. • Distribution 1 now sends BPDUs with its Root Path Cost out other interfaces.
• Again, STP costs are incremented as BPDUs are received on a port, not as they are sent
out a port.
Path Cost
BPDU
Cost=4+19=23
BPDU
BPDU
Cost=19+19=38
Cost=19
19
23 23
19
0 Root Bridge
19
0
19
BPDU
0
Cost=4+19=23
51. Final Results
• Ports show BPDU Received Root Path Cost + Path Cost = Root Path Cost of Interface,
after the “best” BPDU is received on that port from the neighboring switch.
• This is the cost of reaching the Root Bridge from this interface towards the neighboring
switch.
• Now let’s see how this is used!
Path Cost
19+4=23 19+4=23
23+4=27 23+4=27
19+19=38 19+19=38
19 19+4=23
19+4=23 19
19+4=23 19+4=23
0
19 0
0 Root Bridge
52. show spanning-tree Path Cost
Which port is the Root Port?
Core# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.964E.7EBB
Cost 4
Port 25(GigabitEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0001.C945.A573
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi0/1 Root FWD 4 128.25 P2p
Gi0/2 Altn BLK 4 128.26 P2p
53. show spanning-tree detail Path Cost
Which port is the Root Port?
Core# show spanning-tree detail
VLAN0001 is executing the ieee compatible Spanning Tree Protocol
Bridge Identifier has priority of 32768, sysid 1, 0001.C945.A573
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32769
Root port is 25 (GigabitEthernet0/1), cost of root path is 4
Topology change flag not set, detected flag not set
Number of topology changes 0 last change occurred 00:00:00 ago
from FastEthernet0/1
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300
54. Next: Elect Root Ports
• Elect Root Ports • Every non-Root bridge must select one Root Port.
• Elect Designated Ports • A bridge’s Root Port is the port closest to the Root
Bridge.
• Non-Designated Ports: All other ports • Bridges use the cost to determine closeness.
These values Path Cost
would be the
Root Path 23 23
Cost if this
interface was
used to reach 27 27
the Root
Bridge. 38 38
19 23
23 19
23 23 0
19 0
0 Root Bridge
55. Elect Root Ports: (Review)
• Ports show Root Path Cost of Interface, after the “best” BPDU is received on
that port from the neighboring switch.
• This is the cost of reaching the Root Bridge from this interface towards the
neighboring switch.
Distribution 1 “thought process”
Path Cost
If I go
through
Core it costs
27.
If I go
through D2
it costs 38.
If I go
through A1 it
costs 23.
If I go through
A2 it costs 19.
This is the best
path to the
Root!
56. Elect Root Ports:
• This is from the switch’s perspective.
• Switch, “What is my cost to the Root Bridge?”
• Later we will look at Designated Ports, which is from the Segment’s perspective.
Distribution 1 “thought process”
Path Cost
If I go
through
Core it costs
27.
If I go
through D2
it costs 38.
If I go
through A1 it
costs 23.
If I go through
A2 it costs 19.
This is the best
path to the
Root!
57. Elect Root Ports
• Every non-Root bridge must select one Root Port.
• A bridge’s Root Port is the port closest to the Root Bridge.
• Bridges use the Root Path Cost to determine closeness.
? ?
23 23
27 27
38 38
19 23
23 19 RP
RP
23 23 0
19 RP 0
0 Root Bridge
58. Elect Root Ports Five-Step decision Sequence
Step 1 - Lowest BID
• Core switch has two equal Root Path Costs Step 2 - Lowest Path Cost to Root Bridge
to the Root Bridge.
Step 3 - Lowest Sender BID
• In this case we need to look at the five-step Step 4 - Lowest Port Priority
decision process. Step 5 - Lowest Port ID
? ?
23 23
27 27
38 38
19 23
23 19 RP
RP
23 23 0
19 RP 0
0 Root Bridge
59. Elect Root Ports Five-Step decision Sequence
Step 1 - Lowest BID
• Distribution 1 switch has a lower Sender BID Step 2 - Lowest Path Cost to Root Bridge
than Distribution 2.
Step 3 - Lowest Sender BID
• Core chooses the Root Port of G 0/1. Step 4 - Lowest Port Priority
Step 5 - Lowest Port ID
? ?
RP 23 23
My BID is My BID is
32768.0005.5E0D.9315 32768.0060.47B0.5850
Lower BID 27
27
38 38
19 23
23 19 RP
RP
23 23 0
19 RP 0
0 Root Bridge
60. Elect Designated Ports
STP Convergence
Step 1 Elect one Root Bridge
Step 2 Elect Root Ports
Step 3 Elect Designated Ports
• The loop prevention part of STP becomes evident during this step, electing
designated ports.
• A Designated Port functions as the single bridge port that both sends and
receives traffic to and from that segment and the Root Bridge.
• Each segment in a bridged network has one Designated Port, chosen
based on cumulative Root Path Cost to the Root Bridge.
• The switch containing the Designated Port is referred to as the Designated
Bridge for that segment.
• To locate Designated Ports, lets take a look at each segment.
• Segment’s perspective: From a device on this segment, “Which switch
should I go through to reach the Root Bridge?”
– Root Path Cost, the cumulative cost of all links to the Root Bridge.
– Obviously, the segment has not ability to make this decision, so the
perspective and the decision is that of the switches on that segment.
61. • A Designated Port is elected for every segment.
• The Designated Port is the only port that sends and receives traffic to/from that segment to
the Root Bridge, the best port towards the root bridge.
• Note: The Root Path Cost shows the Sent Root Path Cost.
• This is the advertised cost in the BPDU, by this switch out that interface, i.e. this is the cost of
reaching the Root Bridge through me!
RP 23 23
19 19
19 19
19 19
19 19 RP
RP
19 19 0
19 RP 0
0 Root Bridge
62. • A Designated Port is elected for every segment.
• Segment’s perspective: From a device on this segment, “Which switch should I go through
to reach the Root Bridge?”
• “I’ll decide using the advertised Root Path Cost from each switch!”
RP 23 23
? ?
19 19
?
19 19
19 19
19 RP ? ? 19 RP
? ?
19 19 0
19 RP ? 0
Root Bridge
0
63. Segment’s perspective:
• Access 2 has a Root Path Cost = 0 (after all it is the Root Bridge) and Access 1 has a Root Path Cost = 19.
• Because Access 2 has the lower Root Path Cost it becomes the Designated Port for that segment.
RP 23 23
19 19
My designated port willpath0
19 What is my best be 19
via Access 2 (Fa0/5). It’s 19
to the Root Bridge, the
19
19
best path,Access Root0 via
via lowest 1 or Path,
19 19 RP
RP to the Root Bridge.
Access 2?
19 19 0
19 RP ? DP 0
Root Bridge
0
64. Segment’s perspective:
• The same occurs between Access 2 and Distribution ,1 and Access 2 and Distribution 2 switches.
• Because Access 2 has the lower Root Path Cost it becomes the Designated Port for those
segments.
RP 23 23
19 19
19 19
19 19
19 RP
? 19 RP
?
19 19 DP 0 DP
19 RP DP 0
0 Root Bridge
65. Segment’s perspective: Five-Step decision Sequence
• Segment between Distribution 1 and Access 1 has two Step 1 - Lowest BID
equal Root Path Costs of 19. Step 2 - Lowest Path Cost to Root Bridge
• Using the Lowest Sender ID (first two steps are equal), Step 3 - Lowest Sender BID
Access 1 becomes the best path and the Designated
Port. Step 4 - Lowest Port Priority
Step 5 - Lowest Port ID
RP 23 23
32768.0005.5E0D.9315
19 19
What is my best path
19 to the Root 19Bridge, 19
19 19
via Distribution 1 or
19 RP 19 via Access 1? 19 RP
They are the same!
? Who has the lowest
BID?
DP 19 19 DP 0 DP
32768.0003.E461.46EC 19 RP DP 0
0 Root Bridge
Lower BID
66. Access 1 has Lower Sender BID
Distribution1# show spanning-tree detail
Port 26 (GigabitEthernet0/2) of VLAN0030 is designated blocking
Port path cost 4, Port priority 128, Port Identifier 128.26
Designated root has priority 128, address 000C.CF0B.1503
Designated bridge has priority 32798, address 0003.E461.46EC
Designated port id is 128.26, designated path cost 4
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
Access1# show spanning-tree detail
Port 26 (GigabitEthernet1/2) of VLAN0001 is designated forwarding
Port path cost 4, Port priority 128, Port Identifier 128.26
Designated root has priority 128, address 0001.C746.B605
Designated bridge has priority 32769, address 0003.E461.46EC
Designated port id is 128.26, designated path cost 4
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
32768.0003.E461.46EC
Note: PT does not show proper BID
67. Segment’s perspective: Five-Step decision Sequence
• Segment between Distrib. 1 and Distrib. 2 has two equal Step 1 - Lowest BID
Root Path Costs of 19. Step 2 - Lowest Path Cost to Root Bridge
• Using the Lowest Sender ID (first two steps are equal), Step 3 - Lowest Sender BID
Distribution 1 becomes the best path and the Designated
Port. Step 4 - Lowest Port Priority
Step 5 - Lowest Port ID
RP 23 23
32768.0005.5E0D.9315 32768.0060.47B0.5850
19
Lower BID
DP
19
?
19 19
19 19
19 RP 19 RP
19 19 DP 0 DP
19 RP DP 0
0 Root Bridge
68. Distribution 1 has Lower Sender BID
Distribution1# show spanning-tree detail
Port 5 (FastEthernet0/5) of VLAN0030 is designated forwarding
Port path cost 19, Port priority 128, Port Identifier 128.5
Designated root has priority 128, address 000C.CF0B.1503
Designated bridge has priority 32798, address 0005.5E0D.9315
Designated port id is 128.5, designated path cost 19
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
Distribution2# show spanning-tree detail
Port 5 (FastEthernet0/5) of VLAN0001 is designated blocking
Port path cost 19, Port priority 128, Port Identifier 128.5
Designated root has priority 128, address 000C.CF0B.1503
Designated bridge has priority 32769, address 0005.5E0D.9315
Designated port id is 128.5, designated path cost 19
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
Note: PT does not show proper BID
69. Segment’s perspective: Five-Step decision Sequence
• Segment between Access 1 and Distrib. 2 has two equal Step 1 - Lowest BID
Root Path Costs of 19. Step 2 - Lowest Path Cost to Root Bridge
• Using the Lowest Sender ID (first two steps are equal), Step 3 - Lowest Sender BID
Access 1 becomes the best path and the Designated Port.
Step 4 - Lowest Port Priority
Step 5 - Lowest Port ID
RP 23 23
32768.0060.47B0.5850
19 19
DP
19 19
19
19
19
RP ? 19 RP
32768.0003.E461.46EC
19 DP 19 DP 0 DP
Lower BID 19 RP DP 0
0 Root Bridge
70. Access 1 has Lower Sender BID
Distribution2# show spanning-tree detail
Port 25 (GigabitEthernet0/1) of VLAN0001 is designated blocking
Port path cost 4, Port priority 128, Port Identifier 128.25
Designated root has priority 128, address 00D0.BCC1.2603
Designated bridge has priority 32769, address 0003.E461.46EC
Designated port id is 128.25, designated path cost 4
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
Access1# show spanning-tree detail
Port 25 (GigabitEthernet1/1) of VLAN0001 is designated forwarding
Port path cost 4, Port priority 128, Port Identifier 128.25
Designated root has priority 128, address 0001.C746.B605
Designated bridge has priority 32769, address 0003.E461.46EC
Designated port id is 128.25, designated path cost 4
Timers: message age 16, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is point-to-point by default
Note: PT does not show proper BID
71. Segment’s perspective:
• Because Distribution 1 has the lower Root Path Cost it becomes the Designated Port for that
segment.
• Because Distribution 2 has the lower Root Path Cost it becomes the Designated Port for that
segment.
Five-Step decision Sequence
Step 1 - Lowest BID
Step 2 - Lowest Path Cost to
Root Bridge
Step 3 - Lowest Sender BID
RP 23 Step 4 - Lowest Port Priority
23
? ? Step 5 - Lowest Port ID
DP DP
19 19
DP
19 19
19 19
19 RP 19 RP
19 19 DP 0 DP
DP
19 RP DP 0
0 Root Bridge
72. Segment’s perspective:
• All other ports, those ports that are not Root Ports or Designated Ports, become Non-
Designated Ports.
• Non-Designated Ports are put in blocking mode.
• This is the loop prevention part of STP.
RP 23 23
X
NDP
DP
19 19 DP
DP
19
NDP
19 X
NDP
X 19
RP
19
X
NDP 19 RP
19
19 19 DP 0 DP
DP
19 RP DP 0
0 Root Bridge
74. Five-Step decision Sequence
Step 1 - Lowest BID
Port Cost/Port ID Step 2 - Lowest Path Cost to Root Bridge
Step 3 - Lowest Sender BID
Step 4 - Lowest Port Priority
Step 5 - Lowest Port ID
0/2
0/1
Assume path cost and port
priorities are default (32). Port ID
used in this case. Port 0/1 would
forward because it’s the lowest.
• If the path cost and bridge IDs are equal (as in the case of parallel
links), the switch goes to the port priority as a tiebreaker.
• Lowest port priority wins (all ports set to 32).
• You can set the priority from 0 – 63.
• If all ports have the same priority, the port with the lowest port number
forwards frames.
75. Port Cost/Port ID Five-Step decision Sequence
Step 1 - Lowest BID
• Fa 0/3 has a lower Port ID than Fa 04. Step 2 - Lowest Path Cost to Root Bridge
• More later (Fast EtherChannel) Step 3 - Lowest Sender BID
Step 4 - Lowest Port Priority
Step 5 - Lowest Port ID
RP
19
NDP
19
DP
DP
76. Port Cost/Port ID
Distribution1# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0009.7c0b.e7c0
Cost 19
Port 3 (FastEthernet0/3)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 000b.fd13.9080
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Port ID Designated Port ID
Name Prio.Nbr Cost Sts Cost Bridge ID Prio.Nbr
---------------- -------- --------- --- --------- -------------------- --------
Fa0/1 128.1 19 BLK 19 32769 000b.befa.eec0 128.1
Fa0/2 128.2 19 BLK 19 32769 000b.befa.eec0 128.2
Fa0/3 128.3 19 FWD 0 32769 0009.7c0b.e7c0 128.1
Fa0/4 128.4 19 BLK 0 32769 0009.7c0b.e7c0 128.2
Fa0/5 128.5 19 FWD 19 32769 000b.fd13.9080 128.5
Gi0/1 128.25 4 FWD 19 32769 000b.fd13.9080 128.25
77. PVST+ (More later)
• Per VLAN Spanning Tree Plus (PVST+)
maintains a separate spanning-tree
instance for each VLAN.
– PVST Only over ISL
– PVST+ Includes ISL and 802.1Q
• Provides for load balancing on a per-
VLAN basis.
• Switches maintain one instance of
spanning tree for each VLAN allowed on
the trunks.
• Non-Cisco 802.1Q switches maintain
only one instance of spanning tree for all
VLANs allowed on the trunks.
Distribution1(config)# spanning-tree vlan 1, 10 root primary
Distribution2(config)# spanning-tree vlan 20 root primary
80. Load Balancing with 2 Root Switches
Notice that more links are being used!
Root VLANs 1,10 Root VLAN 20
81. STP Convergence: Summary
Recall that switches go through three steps for their initial
convergence:
STP Convergence
Step 1 Elect one Root Bridge
Step 2 Elect Root Ports
Step 3 Elect Designated Ports
Also, all STP decisions are based on a the following predetermined
sequence:
Five-Step decision Sequence
Step 1 - Lowest BID
Step 2 - Lowest Path Cost to Root Bridge
Step 3 - Lowest Sender BID
Step 4 – Lowest Port Priority
Step 5 - Lowest Port ID
82. STP Convergence: Summary
Example:
• A network that contains 15 switches and 146
segments (every switchport is a unique segment)
would result in:
– 1 Root Bridge
– 14 Root Ports
– 146 Designated Ports
84. STP Port States
MAC Address Disabled
Blocking
Listening
Learning
Forwarding
Table BPDUs
Updating Data
Port State BPDU MAC-Add Table Data frames Duration
Disabled None sent/received No update None sent/received Until no shutdown
Administratively shutdown; Not an STP port state
Blocking Receive only No update None sent/received Continuous if loop
detected
Port initializes; receives BPDUs only
Listening Receive and send No update None sent/received Forward delay 15 sec
Building active topology. Thinks port can be selected root or designated port.
Returns to blocking (NDP) if cannot become root or designated port.
Learning Receive and send Updating Table None sent/received Forward delay 15 sec
Building bridging table. Switch can now learn source MAC Addresses but is not
formally receiving frames in order to forward them.
Forwarding Receive and send Updating Table Sent and received Continuous if up and no
loop detected
Sending/Receiving data, no loops detected. Port is either a root or designated port.
85. 2
2
L is t e n in g
5
3
4
1
D is a b le d o r 4
B lo c k in g L e a r n in g
D own
2
7
4
5
6
2
F o r w a r d in g
S ta n d a rd S ta te s C is c o S p e c ific S ta te s
( 1 ) P o r t e n a b le d o r in it ia liz e d (6 ) P o rtF a s t
( 2 ) P o r t d is a b le d o r f a ile d ( 7 ) U p lin k F a s t
( 3 ) P o r t s e le c t e d a s R o o t o r D e s ig n a t e d P o r t
( 4 ) P o r t c e a s e s t o b e a R o o t o r D e s ig n a t e d P o r t
( 5 ) F o r w a r d in g t im e r e x p ir e s
87. STP Timers
Hello Time
• IEEE specifies default of 2 seconds.
• The interval between Configuration BPDUs.
• The Hello Time value configured at the root bridge determines
the Hello Time for all nonroot switches.
• Locally configured Hello Time is used for the TCN BPDU.
88. STP Timers
Forward Delay Timer
• The default value of the forward delay (15 seconds)
• Originally derived assuming a maximum network size of seven bridge
hops
– A maximum of three lost BPDUs, and a hello-time interval of 2
seconds.
– See LAN Switching, by Clark, or other resources for this calculation
• Forward delay is used to determine the length of:
– Listening state
– Learning state
89. STP Timers
Max Age Timer
• Max Age is the time that a bridge stores a BPDU before
discarding it.
• Each port saves a copy of the best BPDU it has received.
• If the device sending this best BPDU fails, it may take 20
seconds before a switch transitions the connected port to
Listening.
90. STP Timers
Modifying Timers
• Do not change the default timer values without careful consideration.
• Cisco recommends to modify the STP timers only on the root bridge
• The BPDUs pass these values from the root bridge to all other bridges in the
network.
• It can take 30-50 seconds for a switch to adjust to a change in topology.
• Switch(config)# spanning-tree vlan vlan-id [forward-time
seconds | hello-time hello-time | max-age seconds |
priority priority | protocol protocol | {root {primary |
secondary} [diameter net-diameter [hello-time hello-
time]]}]
91. Configuring the
Root Bridge
Switch(config)# spanning-tree vlan 1 priority priority
• This command statically configures the priority (in multiples of 4096).
• Valid values are from 0 to 61,440.
• Default is 32768.
• Lowest values becomes Root Bridge.
92. Configuring the
Root Bridge
Switch(config)# spanning-tree vlan 1 root primary
• This command forces this switch to be the root.
• The spanning-tree root primary command alters this switch's bridge priority to
24,576.
• If the current root has bridge priority which is more than 24,576, then the current
is changed to 4,096 less than of the current root bridge.
93. Configuring the
Root Bridge
Switch(config)# spanning-tree vlan 1 root secondary
• This command configures this switch to be the secondary root in
case the root bridge fails.
• The spanning-tree root secondary command alters this switch's
bridge priority to 28,672.
• If the root switch should fail, this switch becomes the next root switch.
94. Change the root bridge
Current Root
Bridge
• Modify the topology so that the Core switch is the root bridge and
Distribution1 is the secondary root bridge for VLAN 1.
95. Change the root bridge
Core(config)# spanning-tree vlan 1-30 root primary
Distribution1(config)# spanning-tree vlan 1-30 root secondary
Notice the change….
Before After
96. Verify changes
Core# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 24577
Address 0001.C945.A573
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24577 (priority 24576 sys-id-ext 1)
Address 0001.C945.A573
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- ----------------------
Gi0/1 Desg FWD 4 128.25 P2p
Gi0/2 Desg FWD 4 128.26 P2p
97. Verify changes
Distribution2# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 24577
Address 0001.C945.A573
Cost 4
Port 26(GigabitEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0060.47B0.5850
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/3 Desg FWD 19 128.3 P2p
Fa0/5 Altn BLK 19 128.5 P2p
Gi0/1 Desg FWD 4 128.25 P2p
Gi0/2 Root FWD 4 128.26 P2p
98. Topology Change Notification BPDUs
• Direct Topology Changes
– Is a change that can be detected on a switch interface.
• Insignificant Topology Changes
– A users PC causes the link to go up or down (normal
booting or shutdown process).
99. TCNs: Direct Topology Change
• When a bridge needs to signal a topology change, it
starts to send TCNs on its root port.
• Switch A detects link down. Config BPDU Root
– Removes “best BPDU” from Root Port (this port
is the best path to the Root Bridge) Idle MAC
entries are
– Can’t send TCN out root port to Root bridge. flushed TCN
C D
– Without Uplinkfast (coming) Switch A not aware
of another path to root.
• Switch C is aware of down link and sends TCN
X RP
B A E
message out RP to Root Bridge.
• Root Bridge sends Configuration BPDU with TCN NDP (Blocking)
New RP (Blocking,
bit set to let switches know of configuration change. Listening, Learning,
Forwarding)
• All switches:
– Shorten MAC address tables aging time to
Forward Delay (15 seconds).
– This flushes idle entries.
• Switch A waits to hear from Root Bridge.
• Receives Config BPDU on previously blocked port,
new “best BPDU”, this becomes new RP.
– This new RP will go through listening, learning
and forwarding states.
• TCN does not start a STP recalculation.
100. TCNs
Idle MAC Idle MAC
• Direct Topology Change: Is a change entries are entries are
that can be detected on a switch flushed flushed
interface. Config BPDU Root
– Can can take about 30 seconds on Idle MAC
the affected switch (two times entries are
flushed C D
forward delay). TCN
– All switches flush idle entries in Idle MAC RP
MAC table. entries are B A E
flushed
– Solutions: Uplinkfast
• Insignificant Topology Change: A Idle MAC
Idle MAC
entries are
users PC causes the link to go up or entries are
flushed
flushed
down (normal booting or shutdown
process).
– No significant impact but given
enough hosts switches could be in
a constant state of flushing MAC
address tables.
– Causes unknown unicast floods.
– Solution PortFast
101. TCN BPDUs
• Understanding Spanning-Tree Protocol Topology
Changes
http://www.cisco.com/warp/public/473/17.html
• Remember that a TCN does not start a STP recalculation.
• This fear comes from the fact that TCNs are often
associated with unstable STP environments; TCNs are a
consequence of this, not a cause.
• The TCN only has an impact on the aging time; it will not
change the topology nor create a loop.
102. STP – Spanning Tree Protocol
CIS 187 Multilayer Switched Networks
CCNP SWITCH
Rick Graziani
Hinweis der Redaktion
BPDU key concepts: Bridges save a copy of only the best BPDU seen on every port. When making this evaluation, it considers all of the BPDUs received on the port, as well as the BPDU that would be sent on that port. As every BPDU arrives, it is checked against this five-step sequence to see if it is more attractive (lower in value) than the existing BPDU saved for that port. Only the lowest value BPDU is saved. Bridges send configuration BPDUs until a more attractive BPDU is received. Okay, lets see how this is used...