Professional Documents
Culture Documents
Objectives
Explain the role of redundancy in a converged network. Summarize how STP works to eliminate Layer 2 loops in a converged network. Explain how the STP algorithm uses three steps to converge on a loop-free topology. Implement rapid PVST+ in a LAN to prevent loops between redundant switches.
Redundancy
Redundancy in a hierarchical network Layer 2 redundancy improves the availability of the network by implementing alternate network paths by adding equipment and cabling.
Redundancy
Examine a redundant design In a hierarchical design, redundancy is achieved at the distribution and core layers through additional hardware and alternate paths through the additional hardware.
Redundancy
Examine a redundant design
Redundancy
Examine a redundant design
Redundancy
Examine a redundant design
Redundancy
Examine a redundant design
Types of Traffic
Unknown Unicast
Types of traffic (Layer 2 perspective) 1. Known Unicast: Destination addresses are in Switch Tables 2. Unknown Unicast: Destination addresses are not in Switch Tables 3. Multicast: Traffic sent to a group of addresses 4. Broadcast: Traffic forwarded out all interfaces except incoming interface.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 9
10
11
12
13
14
15
16
Enable Spanning Tree Protocol (STP) STP ensures that there is only one logical path between all
destinations on the network by intentionally blocking redundant paths that could cause a loop. A port is considered blocked when network traffic is prevented from entering or leaving that port. Block redundant link and auto unblock redundant link when primary link down.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 17
The Spanning-Tree Protocol requires network devices to exchange messages to detect bridging loops, is called a Bridge Protocol Data Unit (BPDU). BPDUs continue to be received on blocked ports.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 18
Spanning-Tree Protocol
STP executes an algorithm called Spanning Tree Algorithm (STA). STA chooses a reference point, called a root bridge, and then
determines the available paths to that reference point. If more than two paths exists, STA picks the best path and blocks the rest STP calculations make extensive use of 2 key concepts in creating a loop-free topology: 1. Bridge ID 2. Path Cost
H c vi n m ng Bch Khoa - Website: www.bkacad.com 19
STP Algorithm
1. 2. 3. 4.
Root Bridge The lowest BID Root Ports - Switch ports closest to the root bridge. Designated ports - All non-root ports that are still permitted to forward traffic on the network. Non-designated ports - All ports configured to be in a blocking state to prevent loops.
20
21
The root bridge maintains the stability of the forwarding paths between all switches for a single STP instance. A spanning tree instance is when all switches exchanging BPDUs and participating in spanning tree negotiation are associated with a single root. If this is done for all VLANs, it is called a Common Spanning Tree (CST) instance. There is also a Per VLAN Spanning Tree (PVST) implementation that provides one instance, and therefore one root bridge, for each VLAN.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 22
Bridge ID (BID)
For each Network, the switch with the highest switch priority (the
lowest numerical priority value) is elected as the root switch. The BID is made up of a priority value, an extended system ID, and the MAC address of the switch.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 23
Bridge ID (BID)
24
Bridge ID (BID)
Priority-based decision The default value for the priority of all Cisco switches is 32768. The priority range is between 1 and 65536; therefore, 1 is the highest priority.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 25
Bridge ID (BID)
MAC Address-based decision
26
27
28
29
30
Each bridge advertises the spanning tree path cost in the BPDU. This spanning tree path cost is the cumulative cost of all the links from the root bridge to the switch sending the BPDU. In Figure, switch Y receives a BPDU from the root bridge (switch X) on its switch port on the Fast Ethernet segment, and another BPDU on its switch port on the Ethernet segment. The root path cost in both cases is 0. The local path cost on the Fast Ethernet switch port is 19, while the local path cost on the Ethernet switch port is 100.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 31
The BPDUs are transmitted in one direction from the root switch, and
each switch sends configuration BPDUs to communicate and to compute the STP topology.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 32
802.3 Header Destination: 01:80:C2:00:00:00 Mcast 802.1d Bridge group Source: 00:D0:C0:F5:18:D1 LLC Length: 38 802.2 Logical Link Control (LLC) Header Dest. SAP: 0x42 802.1 Bridge Spanning Tree Source SAP: 0x42 802.1 Bridge Spanning Tree Command: 0x03 Unnumbered Information 802.1 - Bridge Spanning Tree Protocol Identifier: 0 Protocol Version ID: 0 Message Type: 0x00 Configuration Message Flags: 00000000 Root Priority/ID: 0x8000/ 00:D0:C0:F5:18:C0 Cost Of Path To Root: 0x00000000 (0) Bridge Priority/ID: 0x8000/ 00:D0:C0:F5:18:C0 Port Priority/ID: 0x80/ 0x1D Message Age: 0/256 seconds (exactly 0 seconds) Maximum Age: 5120/256 seconds (exactly 20 seconds) Hello Time: 512/256 seconds (exactly 2 seconds) Forward Delay: 3840/256 seconds (exactly 15 seconds)
H c vi n m ng Bch Khoa - Website: www.bkacad.com 33
802.1d uses 2 types of BPDUs: A configuration BPDU, used for initial STP configuraion. Type field=0x00 A topology change notification (TCN) BPDU used for topology changes. Type field=0x80
34
35
36
37
38
39
40
41
42
43
44
45
Port Roles
46
Port Roles
1. 2.
Root Port The root port exists on non-root bridges and is the switch port with the best path to the root bridge. Designated Port The designated port exists on root and non-root bridges. For root bridges, all switch ports are designated ports. For non-root bridges, a designated port is the switch port that receives and forwards frames toward the root bridge as needed. Only one designated port is allowed per segment. Non-designated Port The non-designated port is a switch port that is blocked, so it is not forwarding data frames and not populating the MAC address table with source addresses.
3.
4.
Disabled Port The disabled port is a switch port that is administratively shut down. A disabled port does not function in the spanning-tree process.
47
48
If all ports have the same priority, the port with the lowest port number
forwards frames. (config-if)# spanning-tree port-priority {number}
49
50
51
52
53
54
55
56
57
If a bridge thinks it is the Root Bridge immediately after booting or in the absence of BPDUs for a certain period of time, the port transitions into the Listening state.
59
60
The BPDU timers not be adjusted directly because the values have been optimized for the seven-switch diameter. Adjusting the spanning-tree diameter value on the root bridge to a lower value automatically adjusts the forward delay and maximum age timers proportionally for the new diameter.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 61
Hello timer: Determines how often root bridge sends configuration BPDUs. The default is 2 seconds. Maximum Age (Max Age): Tells the bridge how long to keep ports in the blocking state before listening. The default is 20 seconds. Forward Delay (Fwd Delay): Determines how long to stay in the listening state before going to the learning state, and how long to stay in the learning state before forwarding. The default is 15 seconds.
62
63
64
STP Convergence
The STP algorithm uses three simple steps to converge on a loop-free
topology. 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
65
STP Convergence STP Convergence Step 1 Elect one Root Bridge Step 2 Elect Root Ports Step 3 Elect Designated Ports
66
67
68
69
STP Convergence STP Convergence Step 1 Elect one Root Bridge Step 2 Elect Root Ports Step 3 Elect Designated Ports
70
71
72
73
74
75
STP Convergence STP Convergence Step 1 Elect one Root Bridge Step 2 Elect Root Ports Step 3 Elect Designated Ports
76
77
78
79
80
81
82
83
84
85
designated bridge
In legacy STP, TCNs were generated for any active port that was not configured for PortFast.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 86
87
88
Extra: PortFast
(config-if)# spanning-tree portfast (config)# spanning-tree portfast default Enable portfast by default on all access ports
When a device is connected to a port, the port normally enters the spanning tree Listening state. When the Forward Delay timer expires, the port enters the Learning state. When the Forward Delay timer expires a second time, the port is transitioned to the Forwarding or Blocking state. When PortFast is enabled on a switch or trunk port, the port is immediately transitioned to the Forwarding state. As soon as the switch detects the link, the port is transitioned to the Forwarding state (less than 2 seconds after the cable is plugged in).
89
Extra: PortFast
90
Extra: UplinkFast
STP UplinkFast accelerates the choice of a new Root Port when a link or switch fails or when STP reconfigures itself. The Root Port transitions to the Forwarding state immediately without going through the Listening and Learning states, as it would with the usual STP process. UplinkFast also limits the burst of multicast traffic by reducing the max-update-rate. For IOS the default for this parameter is 150 packets per second. This change takes approximately 1 to 5 seconds
H c vi n m ng Bch Khoa - Website: www.bkacad.com 91
Extra: UplinkFast
Disable UplinkFast
Enable UplinkFast
92
Extra: UplinkFast
Switch A begins to flood dummy packets with the different MAC addresses that it has in its CAM table as a source.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 93
Extra: BackboneFast
BackboneFast is a Catalyst feature that is initiated when a Root Port or Blocked port on a switch receives inferior BPDUs from its Designated Bridge. An inferior BPDU identifies one switch as both the Root Bridge and the Designated Bridge. When a switch receives an inferior BPDU, it means that a link to which the switch is not directly connected (an indirect link) has failed. That is, the Designated Bridge has lost its connection to the Root Bridge. Under STP rules, the switch ignores inferior BPDUs for the configured Max Age (the default is 20 seconds). This switchover takes approximately 30 seconds, twice the Forward Delay time if the default Forward Delay time of 15 seconds is set. This saves up to 20 seconds.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 94
Extra: BackboneFast
95
Other Example
96
97
98
99
100
PVST+
Cisco developed PVST+ so that a network can run an STP instance for
each VLAN in the network. And Creating different STP root switches per VLAN creates a more redundant network. With PVST+, more than one trunk can block for a VLAN and load sharing can be implemented.
101
PVST+
PVST+ Bridge ID The following provides more details on the PVST+ fields: Bridge priority - A 4-bit field carries the bridge priority Extended system ID - A 12-bit field carrying the VID for PVST+. MAC address - A 6-byte field with the MAC address of a single switch.
102
PVST+
103
104
Configure PVST+
105
Configure PVST+
106
RSTP
What is RSTP? RSTP (IEEE 802.1w) is an evolution of the 802.1D standard. RSTP can achieve much faster convergence in a properly configured network, sometimes in as little as a few hundred milliseconds.
If a port is configured to be an alternate or a backup port it can immediately change to a forwarding state without waiting for the network to converge.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 107
RSTP
The immediate consideration with STP is convergence time. Depending on the type of failure, it takes anywhere from 30 to 50 seconds to converge the network. RSTP helps with convergence issues that plague legacy STP. RSTP has additional features similar to UplinkFast and BackboneFast that offer better recovery at Layer 2. RSTP is proactive and therefore negates the need for the 802.1D delay timers. RSTP (802.1w) supersedes 802.1D, while still retaining backward compatibility. Much of the 802.1D terminology remains, and most parameters are unchanged. In addition, 802.1w is capable of reverting back to 802.1D to interoperate with legacy switches on a per-port basis. Because the RSTP and Cisco-proprietary enhancements are functionally similar, features such as UplinkFast and BackboneFast are not compatible with RSTP.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 108
RTSP BPDU
RSTP (802.1w) uses type 2, version 2 BPDUs, so an RSTP bridge can communicate 802.1D on any shared link or with any switch running 802.1D. Because BPDUs are used as a keepalive mechanism, 3 consecutively missed BPDUs indicate lost connectivity between a bridge and its neighboring root or designated bridge.
109
RSTP sends BPDUs and populates the flag byte in a slightly different manner than 802.1D: An RSTP bridge sends a BPDU with its current information every hello time period (2 seconds by default), even if it does not receive any BPDUs from the root bridge. Protocol information can be immediately aged on a port if hellos are not received for three consecutive hello times or if the max age timer expires. Because BPDUs are now used as a keepalive mechanism, three consecutively missed BPDUs indicate lost connectivity between a bridge and its neighboring root or designated bridge. This fast aging of the information allows quick failure detection. Unlike in legacy STP, each switch generates its own BPDUs regardless if it hears BPDUs from the root. In legacy STP, BPDUs were only generated by the root and propagated throughout the spanning tree domain. As a result, when a switch did not receive a configuration BPDU, it did not know where the failure occurred. In RSTP mode, the switch needs to worry only about its immediate neighbors.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 110
Edge Ports
Ports not participating in spanning tree are called edge ports. The edge port concept is already well known to Cisco spanning tree users, as it basically corresponds to the PortFast feature. All ports directly connected to end stations cannot create bridging loops in the network. Therefore, the edge port directly transitions to the forwarding state, and skips the listening and learning stages.
Unlike PortFast, an RSTP edge port that receives a BPDU loses its edge port status immediately and becomes a normal spanningtree port. The edge port immediately becomes a non-edge port if a BPDU is heard on the port.
111
Unlike PortFast, an edge port that receives a BPDU loses its edge port
status immediately and becomes a normal spanning tree port. When a switch with an edge port receives a BPDU, it generates a TCN.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 112
Link Types
Non-edge ports are categorized into 2 link types: 1. point-to-point 2. shared. The link type is automatically derived from the duplex mode of a port. A port that operates in fullduplex is assumed to be pointtopoint, while a halfduplex port is considered as a shared port by default. RSTP can only achieve rapid transition to the forwarding state on edge ports and on pointtopoint links. Non-edge ports participate in the spanning tree algorithm and only non-edge ports generate topology changes (TCs) on the network when transitioning to forwarding state. TCs are not generated for any other RSTP states.
113
Root ports do not use the link type parameter. Root ports are able to make a rapid transition to the forwarding state as soon as the port is in sync. In addition, alternate and backup ports do not use the link type parameter in most cases. Designated ports make the most use of the link type parameter. Rapid transition to the forwarding state for the designated port occurs only if the link type parameter indicates a point-to-point link.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 114
115
The role is now a variable assigned to a given port. The root port and designated port roles remain. The blocking port role is now split into the backup and alternate port roles. The Spanning Tree Algorithm (STA) determines the role of a port based on Bridge Protocol Data Units (BPDUs). To keep things simple, the thing to remember about a BPDU is that there is always a way of comparing any two of them and deciding whether one is more useful than the other. This is based on the value stored in the BPDU and occasionally on the port on which they are received.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 116
117
Alternate Port
An alternate port provides an alternate path to the root bridge and could therefore replace the root port should it fail.
118
Backup Port
A backup port provides redundant connectivity to the same segment and cannot guarantee an alternate connectivity to the root bridge. It was therefore excluded from the uplink group.
119
In IEEE 802.1D STP, when a port has been selected by spanning tree to become a designated port, it must wait two times the forward delay before transitioning the port to the forwarding state. RSTP significantly speeds up the recalculation process after a topology change, because it converges on a link-by-link basis and does not rely on timers expiring before ports can transition. Rapid transition to the forwarding state can only be achieved on edge ports and point-to-point links.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 120
A port is in-sync if it meets either of the following criteria: It is in a Blocking state (which means discarding, in a stable topology). It is an edge port.
121
Switch A has a path to the root via switch B and switch C. A new link is then created between the root and switch A, and both ports are in designated blocking state until they receive a BPDU from their counterpart. When a designated port is in a discarding or learning state (and only in this case), it sets the proposal bit on the BPDUs it sends out. This is what happens for port P0 of the root bridge. Switch A sees that the proposal BPDU has a superior path cost. It blocks all non-edge designated ports other than the one over which the proposal-agreement process are occurring. This operation is called sync and prevents switches below A from causing a loop during the proposal-agreement process. Edge ports do not have to be blocked and remain unchanged during sync. Bridge A sends an agreement that allows the root bridge to put root port P0 in forwarding state. Port P1 becomes the root port for A.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 122
Animation 5.4.6.3
123
124
125
Minimize the Number of Blocked Ports The only critical action that STP takes is the blocking of ports. A single blocking port that mistakenly transitions to forwarding can negatively impact a large part of the network. A good way to limit the risk inherent in the use of STP is to reduce the number of blocked ports as much as possible.
126
Only switch D1 receives unnecessary broadcast and multicast traffic for VLAN 20, but it is also blocking one of its ports for VLAN 30. The are three redundant paths between core switch C1 and core switch C2. This redundancy results in more blocked ports and a higher likelihood of a loop.
127
128
The design ensures a convergence that is even faster than convergence with STP. STP no longer blocks any single port, so there is no potential for a bridging loop. Leaving the VLAN by Layer 3 switching is as fast as bridging inside the VLAN.
H c vi n m ng Bch Khoa - Website: www.bkacad.com 130
131
132
For some reason port F0/3 on switch S2 fails to receive BPDUs for the Default max_age time of 20 seconds.
133
For some reason port F0/3 on switch S2 fails to receive BPDUs for the Default max_age time of 20 seconds.
134
135
136
137
138
139
140
141
142
143
144
145
146
Summary
147
148