Professional Documents
Culture Documents
Spanning Tree
Agenda
Spanning Tree.
Spanning-Tree Basics
Spanning Tree.
STP is a link management protocol that provides path redundancy while preventing undesirable loops in the network
Spanning Tree.
1. Without the spanning-tree protocol in a redundant topology, a frame sourced from A would loop endlessly in the network.
Spanning Tree.
X
Blocked port
1. Without the spanning-tree protocol in a redundant topology, a frame sourced from A would loop endlessly in the network. 2. The spanning-tree protocol blocks redundant links to prevent frames from looping.
Spanning Tree.
X
X
Blocked port Remove blocked port
1. Without the spanning-tree protocol in a redundant topology, a frame sourced from A would loop endlessly in the network. 2. The spanning-tree protocol blocks redundant links to prevent frames from looping. 3. The spanning-tree protocol can adjust to changes in the topology by adjusting which ports are blocking and which are forwarding.
Spanning Tree.
Spanning-Tree Concepts
Spanning Tree.
Max age
Bridge priority (per bridge) Port-specific parameters Port cost Port priority BPDUs Configuration Topology Change Notification
Spanning Tree.
10
1
Designated Port Root Port
F
Root bridge
Designated Port
F
B
Non-Designated Port
2 F
C
Root Port
F
D
Root Port
Designated Port
Non-Designated Port
3
Designated Port Port selected for forwarding Non-Designated Port Port in blocking mode
Spanning Tree.
11
Spanning Tree.
12
Spanning Tree.
13
All bridges have an 8 byte bridge ID2 bytes bridge priority, 6 bytes MAC address
For example, here 32768 is the Bridge priority and 0080.acff.0003 is the MAC address of the bridge
32768:0080.acff.0003
Lowest bridge ID (BID) becomes root Lower bridge priority has a greater chance of becoming root
Spanning Tree.
2000, Cisco Systems, Inc.
14
15
16
Spanning Tree.
17
Spanning Tree.
18
Spanning Tree.
19
20
Listening
Blocking
TCN TCN
Learning
Forwarding
Spanning Tree.
21
Port-specific parameters
Port cost Port priority
Spanning Tree.
22
The frequency with which a designated port will send BPDUs One to two second range Two seconds by default
Spanning Tree.
23
24
Spanning Tree.
25
Spanning Tree.
26
Spanning Tree.
27
Spanning Tree.
28
Configuration BPDU
Orginated by root switch and sent on all the designated ports (all ports on the root switch are designated ports)
On all other switches in the network (in a steady state), configuration BPDUs are received on root ports & blocked ports only (never sent)
Forwarded on designated ports by changing the BID & adding the port cost of the received port to the root path cost in the transmitted BPDU When a designated port hears an inferior BPDU, it sends a configuration BPDU with its stored BPDU information
Spanning Tree.
29
Root Identifier Root Path Cost Bridge Identifier Port Identifier Message Age
Max Age Hello Time Forward Delay Topology Change Ack. Topology Change
Spanning Tree.
30
Protocol Identifier
Ver
Msg Type
Flags
Root ID
Bridge ID
Port ID
Msg Age
Max Age
Hello Time
Forward Delay
Spanning Tree.
31
LLC: DSAP Address = 42, DSAP IG Bit = 00 (Individual Address) LLC: SSAP Address = 42, SSAP CR Bit = 00 (Command) LLC: Unnumbered frame: UI LLC:
DSAP/SSAP of 0x42 is BPDU
Spanning Tree.
32
Always 0 00 Configuration BPDU 80 TCN BPDU LSB = TC flag; MSB = TCA flag
Root Bridge ID
Spanning Tree.
33
BPDU: Information Lifetime = 20.000 seconds BPDU: Root Hello Time BPDU: Forward Delay BPDU: DLC: Frame padding= 7 bytes = 2.000 seconds = 15.000 seconds
Spanning Tree.
34
Sent from the bridge with the topology change towards the root bridge A TCN received on a designated port of a non-root switch is forwarded towards the root
Spanning Tree.
35
Protocol Identifier
Ver
Msg Type
Spanning Tree.
36
Spanning Tree.
37
2. Bridge Bs port moves out of forwarding mode. 3. Bridge B generates a TCN BPDU and sends it on the root port. 4. Bridge C ACKs the TCN in the next BPDU it sends to Bridge B. 5. Bridge C generates a TCN BPDU and sends it on the root port. 6. Root ACKs the TCN in the next BPDU it sends to Bridge C.
TCN ACK
B
X
A
Spanning Tree.
2000, Cisco Systems, Inc.
Bridge fails
38
7. Root also sets the topology change (TC) flag in all Config BPDUs 8. Downstream bridges reduce CAM aging time to FwdDelay seconds for duration of the topology change. 9. Root sets TC flag in all BPDUs for MaxAge + FwdDelay seconds, then clears the TC flag.
TC Flag
TC Flag
Spanning Tree.
39
Spanning Tree.
40
Spanning Tree.
41
Spanning Tree.
42
set spantree <enable|disable> set spantree portvlanpri set spantree priority set spantree hello set spantree maxage set spantree fwddelay set spantree portcost set spantree portpri set spantree portvlancost set spantree root [secondary] set spantree portfast set spantree portfast bpdu-guard set spantree uplinkfast set spantree backbonefast set spantree guard root
Spanning Tree.
43
44
Spanning Tree.
45
Spanning Tree.
46
Spanning Tree.
47
48
PVST
PVST Per-VLAN Spanning Tree
Spanning Tree.
49
PVST+
PVST+ Per-VLAN Spanning Tree Plus Developed to accommodate the IEEE 802.1Q standard for VLAN trunking PVST+ maintains a per-VLAN spantree for both 802.1Q and ISL PVST+ can interoperate with MST domains (3rd party) while maintaining a PVST for 802.1Q and/or ISL (no config required)
For more info, see An Engineering Guide to IEEE 802.1Q and IEEE 802.1p (ENG-18215)
Spanning Tree.
50
MST
IEEE 802.1Q describes a Mono Spanning Tree (MST) a single spantree dictates the topology for all VLANs
Spanning Tree.
51
PVST/PVST+/MST Interoperation
To interoperate with 3rd party 802.1Q-capable devices, use the set trunk mod/port nonegotiate dot1q command All Cisco PVST+ connections to the MST region must be through 802.1q trunks PVST and PVST+ regions can communicate over ISL trunk links MST and PVST+ regions can connect over an 802.1q trunk
Spanning Tree.
52
PVST/PVST+/MST Interoperation
Two techniques to provide transparent STP support across the different types of regions:
Mapping Used between PVST and PVST+ regions; each spantree in the PVST region maps to a spantree in PVST+ region on a one-to-one basis Tunneling Used between MST and PVST+ regions; implements a combination of mapping and tunneling
Spanning Tree.
53
Spanning Tree.
54
Spanning Tree.
55
Used to load share traffic across redundant links which would otherwise have been unused as the ports would be blocked by spanning tree. Technique is to associate different port costs with different VLANs on a single port.
Spanning Tree.
56
L3 S1 L1 (10,10) L2 (10,10) S3
BID 32768.0000.0000.0003 BID 32768.0000.0000.0033
Link L1, L2, and L3 are VLAN trunks The port cost is 10 on all ports for all VLANs S1 is the root switch for all VLANs The L1 port on S3 is blocking for all VLANs & therefore cannot carry data traffic
This is because S3s root path cost = 10 on L2 but 10+10=20 on L1+L3
Spanning Tree.
2000, Cisco Systems, Inc.
57
L3 S1 L1 (10,10) ( L2
30,10)
S3
If we change the port cost for the Red VLAN to 30 on S3s L2 port, then L2 becomes the blocking link for VLAN Red and L1 becomes the forwarding link for VLAN Red
This is because S3s root path cost = 30 on L2 but only 10+10=20 on L1+L3.
Spanning Tree.
58
PortVlanCost Implementation
Associating a different port cost for different
VLANs for all ports requires too much memory Therefore, we associate all VLANs with one of two possible portcosts (known as portvlancost) Using just two portvlancosts per port and
associating all VLANs with one or the other of these costs, we can load balance VLANs over two
paths
Spanning Tree.
59
Cost is between 1-65535 The cost value is one less than the current port cost for that port by default If supplied, the value must be lower than the current port cost
Spanning Tree.
60
Spanning Tree.
61
Spanning Tree.
62
Root (Red)
BID 8192.0000.0000.0002 S2 BID 16384.0000.0000.0022
S1
L1 (10,10) L2 (10,10) S3
BID 32768.0000.0000.0003 BID 32768.0000.0000.0033
Root (Blue)
BID 16384.0000.0000.0001 BID 8192.0000.0000.0011
Simpler configuration: Move the root switch for the Red VLAN to S2
Spanning Tree.
63
To return a VLAN to the default settings, use clear spantree root <VLAN list>
Spanning Tree.
2000, Cisco Systems, Inc.
64
Someone could change the bridge priority on another switch to make that the root switch Someone could change the bridge priority on this switch to make it a nonroot switch
Spanning Tree.
2000, Cisco Systems, Inc.
65
Spanning Tree.
The switch uses the formula specified in the 802.1D spec to calculate the new values of max age and forward delay
2000, Cisco Systems, Inc.
Spanning Tree.
67
68
Spanning Tree.
69
Spanning-Tree PortFast
set spantree portfast <mod/port> <enable|disable>
Causes a switch port to transition to the forwarding state immediately, bypassing the listening & learning states Prevents connectivity issues related to forwarding delay Most common problems are seen with DHCP, IPX GNS, and AppleTalk
Spanning Tree.
2000, Cisco Systems, Inc.
70
Spanning-Tree PortFast
Use only on host ports (otherwise, you might open temporary spantree loops) Failsafe if a BPDU is received on the port, transition to listening mode No TCN is generated for state changes on portfast ports
Use in combination with set trunk off and set port channel off (or just use set port host)
Spanning Tree.
2000, Cisco Systems, Inc.
71
Listening
Blocking
TCN TCN
Learning
Forwarding
Spanning Tree.
72
Console> (enable) show spantree 8/10 ------------------------ ---- ------------- --------- ---- -------- ----------
Spanning Tree.
73
Safeguard to make sure rogue bridges are not allowed to connect to the network through host ports If a BPDU is received on a portfast-enabled port, that port is placed in the errdisable state
Works only on portfast-enabled ports Disabled by default If BPDUs stop arriving on the port, the port is reenabled automatically Also works with errdisable-timeout feature
Spanning Tree.
2000, Cisco Systems, Inc.
74
Port
5/1
Name
Status
Vlan
Spanning Tree.
75
Console> (enable) show spantree summary Root switch for vlans: 1-3,5,10,20. Portfast bpdu-guard enabled for bridge. Uplinkfast disabled for bridge. Backbonefast disabled for bridge.
< . . . >
Spanning Tree.
76
Spanning-Tree UplinkFast
Spanning Tree has relatively slow convergence in recovering from faults
At default values, convergence time varies between 30-50 seconds In the wiring closet, the typical design has a redundant link into the distribution/core that is in spantree blocking mode
Spanning Tree.
77
78
Spanning Tree.
79
Spanning Tree.
80
Increases the bridge priority value on all VLANs to 49152 (so the switch is unlikely to become root)
Increases the portcost of all ports by 3000 (so the switch is unlikely to be the designated bridge on any segment)
The rate sets the rate of transmission of dummy multicast packets (packets/100 ms) If protocol filtering is enabled upstream, use allprotocols option
Spanning Tree.
2000, Cisco Systems, Inc.
81
All-protocols field set to off. Turn on if protocol filtering is enabled on uplink switch but not on this switch
Spanning Tree.
82
-------------------Number of transitions via uplinkFast (all VLANs) Console> (enable) : 10 Number of proxy multicast addresses transmitted (all VLANs) : 4234
Spanning Tree.
83
2
7
4/1(fwd), 5/4
5/1(fwd)
Vlan 1 has 4/1 as root port, 4/2 and 5/3 as redundant root ports
Vlan 2 has 4/1 as root port, but only one redundant port, 5/4 Vlan 7 has 5/1 as the root port and no redundant ports
Spanning Tree.
84
Spanning Tree.
85
Spanning Tree.
86
X
These switches do not see a link down
Spanning Tree.
87
X
B
Blocking
1. 2. 3. 4. 5. 6.
7.
Link between A & B fails B detects link failure and send out BPDU claiming to be root C ignores B and MaxAges BPDU on blocked port toward B (20 seconds) MaxAge expires and C transmits a BPDU toward B B receives superior BPDU from C and establishes root port C transitions the port toward B through listening (15 seconds) and learning (15 seconds) C transitions the port toward B into forwarding and begins sending traffic Convergence time = MaxAge + (2 * FwdDelay) = 50 sec
Spanning Tree.
88
Inferior BPDUs
If the switch receives an inferior BPDU from the designated bridge, we know that the designated bridge has either:
1. Lost the root
Root
Root
Spanning Tree.
89
Only inferior BPDUs sent by the designated bridge are tracked (i.e., inferior BPDUs sent with the same BID as the stored BPDU)
If a newly inserted bridge starts sending inferior BPDUs, it will not trigger the BackboneFast feature
Spanning Tree.
90
91
X
B
1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
Blocking
Link between A & B fails B detects link failure and send out BPDU claiming to be root C detects possible indirect failure, sends RLQ toward root D forwards RLQ on the root port A receives the RLQ & sends a response D floods the response on all designated ports C receives the response and expires the BPDU on the port toward B (skips MaxAge) B receives superior BPDU from C and establishes root port C transitions the port toward B through listening (15 seconds) and learning (15 seconds) C transitions the port toward B into forwarding and begins sending traffic Convergence time = (2 * FwdDelay) = 30 sec
Spanning Tree.
92
Spanning Tree.
93
: 0 : 0 : 0 : 0 : 0
94
Spanning Tree.
95
Root
Spanning Tree.
96
Spanning Tree.
97
Spanning Tree.
98
Console> (enable) set spantree guard root 1/1 Rootguard on port 1/1 is enabled. Console> (enable) 2001 Jun 15 07:04:15 %SPANTREE-2ROOTGUARDBLOCK:Port 1/1 tried to become nondesignated in VLAN 1. Moved to root-inconsistent state
Spanning Tree.
99
Console> (enable) show spantree guard Port 1/1 1/2 8/1 VLAN Port-State 1 1 1 root-inconsis forwarding not-connected Guard Type root root none ------------------------ ---- ------------- ----------
Spanning Tree.
100
Spanning Tree.
101
Spanning Tree.
102
2) Design issues
Spanning Tree.
103
Spanning Tree.
104
Unidirectional links
Data corruption (BPDUs dropped) Port Stuck (BPDUs dropped) NMP stops listening to spanning-tree (stuck inband) Loss of management communication to line cards
Spanning Tree.
2000, Cisco Systems, Inc.
105
4) System LED indicators on Switch Utilization Bar 5) High Amount of In-lost and Out-lost on show mac 6) MLS: TOO MANY MOVES appearing on console and log (Cat5000 only) 7) HSRP, OSPF, etc report duplicate IP address 8) Unicast flooding
Spanning Tree.
2000, Cisco Systems, Inc.
106
Spanning Tree.
107
During an Event
Remove redundant Ethernet segments from the network
Start with connections between core switches Begin with EtherChannels, if used Wait for 30-60 seconds for the network to recover before removing another link If the network does not recover, continue methodically removing redundancy until the network stabilizes
108
Spanning Tree.
109
Take proactive measures (perform these tasks prior to having another event)
Turn spantree logging level on the switches to 6 (set logging level spantree 6 default) to see state transitions & TCNs (also, log to a server)
On switches running IOS, use debug spanning events Enter clear counters on all switches
Spanning Tree.
110
esc-cat6500-a> (enable) show spantree 5 VLAN 5 Spanning tree enabled Spanning tree type ieee Designated Root 00-d0-06-26-f4-04 Designated Root Priority 8192 Designated Root Cost 3 Designated Root Port 2/1-2 (agPort 13/33) Root Max Age 20 sec Hello Time 2 sec Forward Delay Bridge ID MAC ADDR 00-d0-bb-01-30-04 Bridge ID Priority 32768 Bridge Max Age 20 sec Hello Time 2 sec Forward Delay Port Vlan Port-State Cost Priority ------------------------ ---- ------------- ----- -------2/1-2 5 forwarding 3 32 15/1 5 forwarding 4 32
Channel_id ---------801 0
Spanning Tree.
111
Designated root cost on the root is always 0 RootID and BID will match on the root bridge
15 sec
esc-6500-b> (enable) show spantree summary Root switch for vlans: 4-10.
In 5.4 and later, use show spantree summary to see for which VLANs the switch is root
Spanning Tree.
112
Spanning Tree.
113
esc-6500-b> (enable) show spantree blocked T = trunk g = group Ports Vlans Ports 8/23 and 8/24 are -------------blocking for VLAN 1 8/23 (T) 1 8/24 (T) 1 Number of blocked ports (segments) in the system : 2
Spanning Tree.
114
Make sure the config bpdus received counter is incrementing on the port approximately every 2 seconds
Spanning Tree.
115
Spanning Tree.
116
00-d0-00-3f-a0-02 49152 Hello Time 2 sec Forward Delay 15 sec Vlan ---3 3 3 Port-State Cost Priority Portfast Channel_id ------------- ----- -------- ---------- ---------blocking 3019 32 disabled 0 forwarding 3019 32 disabled 0 forwarding 3002 32 disabled 865
117
Config BPDU stats for port & VLAN TCN BPDU stats for port & VLAN
118
Other port-specific info dynamic max age transitions 0 port bpdu ok count 0 msg age expiry count 0 link loading 1 bpdu in processing FALSE num of similar bpdus to process 0 received_inferior_bpdu FALSE next state 4
Spanning Tree.
119
References
Cisco Press Cisco LAN Switching book, two chapters on Spanning Tree
Troubleshooting Spanning-Tree Protocol and Related Design Considerations
http://www.cisco.com/warp/customer/473/16.html
Spanning Tree.
120
121