Download presentation
1
Spanning Tree Protocol
Module 3 Spanning Tree Protocol
2
Spanning Tree Protocol (STP)
STP allows L2 devices to communicate with each other to discover physical loops in the network. STP specifies an algorithm that L2 devices can use to create a loop-free logical topology. STP creates a tree structure of loop-free leaves and branches that spans the entire Layer 2 network.
3
Redundancy Creates Loops
4
L2 Loops Broadcasts and Layer 2 loops can be a dangerous combination.
Ethernet frames have no TTL field After an Ethernet frame starts to loop, it will probably continue until someone shuts off one of the switches or breaks a link.
5
L2 Loops - Flooded unicast frames
Where’s Host B? FLOOD Where’s Host B? FLOOD Where’s Host B? FLOOD Where’s Host B? FLOOD And the floods continue Removed from the network
6
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.
7
Spanning Tree Algorithm
STP executes an algorithm called 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
8
Two-key STP Concepts STP calculations make extensive use of two key concepts in creating a loop-free topology: Bridge ID Path Cost
9
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.
10
Used to elect a root bridge
Lowest Bridge ID is the root. If all devices have the same priority, the bridge with the lowest MAC address becomes the root bridge.
11
Path Cost IEEE modified the most to use a non-linear scale with the new values of: 4 Mbps (cost) 10 Mbps (cost) 16 Mbps (cost) 45 Mbps (cost) 100 Mbps (cost) 155 Mbps (cost) 622 Mbps (cost) 1 Gbps (cost) 10 Gbps (cost)
12
BID and Path Cost BID and Path Cost are used to develop a loop-free topology . But first the Four-Step STP Decision Sequence
13
Four-Step STP Decision Sequence
When creating a loop-free topology, STP uses: Four-Step decision Sequence Step 1 - Lowest BID Step 2 - Lowest Path Cost to Root Bridge Step 3 - Lowest Sender BID Step 4 - Lowest Port ID Bridges use Configuration BPDUs during this four-step process.
14
Four-Step STP Decision Sequence
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 four-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...
15
Three Steps of Initial STP Convergence
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
16
STP Convergence Step 1 Elect one Root Bridge Step 2 Elect Root Ports Step 3 Elect Designated Ports
17
Sample Topology
18
STP Convergence Step 1 Elect one Root Bridge
When the network first starts, all bridges are announcing a chaotic mix of BPDUs. All bridges immediately begin applying the four-step sequence decision process. Switches need to elect a single Root Bridge. Switch with the lowest BID wins! Note: “highest priority” is the “lowest” BID value. This is known as the “Root War.”
19
STP Convergence Step 1 Elect one Root Bridge
Cat-A has the lowest Bridge MAC Address, so it wins the Root War! All 3 switches have the same default Bridge Priority value of 32,768
20
STP Convergence Step 1 Elect one Root Bridge
Its all done with BPDUs!
21
STP Convergence Step 1 Elect one Root Bridge
At the beginning, all bridges assume they are the center of the universe and declare themselves as the Root Bridge, by placing its own BID in the Root BID field of the BPDU.
22
STP Convergence Step 1 Elect one Root Bridge
Once all of the switches see that Cat-A has the lowest BID, they are all in agreement that Cat-A is the Root Bridge.
23
STP Convergence Step 1 Elect one Root Bridge Step 2 Elect Root Ports Step 3 Elect Designated Ports
24
STP Convergence Step 2 Elect 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! Bridges track the Root Path Cost, the cumulative cost of all links to the Root Bridge.
25
Sample Topology
26
Cat-A sends out BPDUs, containing a Root Path Cost of 0.
Step 1 Cat-A sends out BPDUs, containing a Root Path Cost of 0. Cat-B receives these BPDUs and adds the Path Cost of Port 1/1 to the Root Path Cost contained in the BPDU. Step 2 Cat-B add Root Path Cost 0 PLUS its Port 1/1 cost of 19 = 19
27
BPDU Cost=0 BPDU Cost=0 BPDU Cost=19 BPDU Cost=19 BPDU Cost=19 BPDU Cost=19 BPDU Cost=38 (19=19) BPDU Cost=38 (19=19) Step 3 Cat-B uses this value of 19 internally and sends BPDUs with a Root Path Cost of 19 out Port 1/2. Step 4 Cat-C receives the BPDU from Cat-B, and increased the Root Path Cost to 38 (19+19). (Same with Cat-C sending to Cat-B.)
28
BPDU Cost=0 BPDU Cost=0 BPDU Cost=19 BPDU Cost=19 Root Port Root Port BPDU Cost=38 (19=19) BPDU Cost=38 (19=19) Step 5 Cat-B calculates that it can reach the Root Bridge at a cost of 19 via Port 1/1 as opposed to a cost of 38 via Port 1/2. Port 1/1 becomes the Root Port for Cat-B, the port closest to the Root Bridge. Cat-C goes through a similar calculation. Note: Both Cat-B:1/2 and Cat-C:1/2 save the best BPDU of 19 (its own).
29
STP Convergence Step 1 Elect one Root Bridge Step 2 Elect Root Ports Step 3 Elect Designated Ports
30
STP Convergence Step 3 Elect 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. Root Path Cost, the cumulative cost of all links to the Root Bridge.
31
Root Path Cost = 0 Root Path Cost = 0 Segment 1 Segment 2 Root Path Cost = 19 Root Path Cost = 19 Root Port Root Port Root Path Cost = 19 Root Path Cost = 19 Segment 3 Segment 1: Cat-A:1/1 has a Root Path Cost = 0 (after all it is the Root Bridge) and Cat-B:1/1 has a Root Path Cost = 19. Segment 2: Cat-A:1/2 has a Root Path Cost = 0 (after all it is the Root Bridge) and Cat-C:1/1 has a Root Path Cost = 19. Segment 3: Cat-B:1/2 has a Root Path Cost = 19 and Cat-C:1/2 has a Root Path Cost = 19. It’s a tie!
32
Root Path Cost = 0 Root Path Cost = 0 Segment 1 Segment 2 Designated Port Designated Port Root Path Cost = 19 Root Path Cost = 19 Root Port Root Port Root Path Cost = 19 Root Path Cost = 19 Segment 3 Segment 1 Because Cat-A:1/1 has the lower Root Path Cost it becomes the Designate Port for Segment 1. Segment 2 Because Cat-A:1/2 has the lower Root Path Cost it becomes the Designate Port for Segment 2.
33
Both Cat-B and Cat-C have a Root Path Cost of 19, a tie!
Segment 1 Segment 2 Designated Port Designated Port Root Path Cost = 19 Root Path Cost = 19 Root Port Root Port Root Path Cost = 19 Root Path Cost = 19 Segment 3 Segment 3 Both Cat-B and Cat-C have a Root Path Cost of 19, a tie! When faced with a tie (or any other determination) STP always uses the four-step decision process: 1. Lowest Root BID; Lowest Path Cost to Root Bridge; 3. Lowest Sender BID; 4. Lowest Port ID
34
2) Root Path Cost for both is 19, also a tie.
Segment 1 Segment 2 Designated Port Designated Port Root Path Cost = 19 Root Path Cost = 19 Root Port Root Port 32,768.CC-CC-CC-CC-CC-CC 32,768.BB-BB-BB-BB-BB-BB Root Path Cost = 19 Root Path Cost = 19 Designated Port Segment 3 Non-Designated Port Segment 3 (continued) 1) All three switches agree that Cat-A is the Root Bridge, so this is a tie. 2) Root Path Cost for both is 19, also a tie. 3) The sender’s BID is lower on Cat-B, than Cat-C, so Cat-B:1/2 becomes the Designated Port for Segment 3. Cat-C:1/2 therefore becomes the non-Designated Port for Segment 3.
35
Spanning-Tree Port States
36
Port Cost/Port ID 0/2 0/1 Assume path cost and port priorities are default (128). 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 128). You can set the priority from 0 – 255. If all ports have the same priority, the port with the lowest port number forwards frames.
37
STP Convergence Recap 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: Four-Step decision Sequence Step 1 - Lowest BID Step 2 - Lowest Path Cost to Root Bridge Step 3 - Lowest Sender BID Step 4 - Lowest Port ID
38
Spanning-Tree Port States
39
Spanning-Tree Port States
Blocked: All ports start in blocked mode in order to prevent the bridge from creating a bridging loop. Port are listening (receiving) BPDUs. No user data is being passed. The port stays in a blocked state if Spanning Tree determines that there is a better path to the root bridge. May take a port up to 20 seconds to transition out of this state (max age).
40
Spanning-Tree Port States
Listen: The port transitions from the blocked state to the listen state Attempts to learn whether there are any other paths to the root bridge Listens to frames Port is not sending or receive user data Listens for a period of time called the forward delay (default 15 seconds). Ports that lose the Designated Port election become non-Designated Ports and drop back to Blocking state.
41
Spanning-Tree Port States
Learn: The learn state is very similar to the listen state, except that the port can add information it has learned to its address table. Adds addresses to MAC Address Table Still not allowed to send or receive user data Learns for a period of time called the forward delay (default 15 seconds)
42
Spanning-Tree Port States
Forward: The port can send and receive user data. A port is placed in the forwarding state if: There are no redundant links or It is determined that it has the best path to the root
43
Spanning-Tree Port States
Disabled: The port is shutdown.
44
Results of BPDU exchange
A root port for each switch and a designated port for each segment is selected. These ports provide the best path from the switch to the root switch (usually the lowest-cost path). These ports are put in the forwarding mode. Ports that will not be forwarding are placed in the blocked state. These ports will continue to send and receive BPDU information but will not be allowed to send or receive data.
45
Spanning-Tree Port States
46
Configuring STP By default, STP is enabled for every port on the switch. If for some reason STP has been disabled, you can reenable it.
47
Configuring STP Enable Spanning Tree (Enabled by default)
Switch(config)# spantree vlan-list Configure STP timers Switch(config)# spanning-tree [vlan vlan-list] [hello-time seconds] * Default = 2 seconds [forward-time seconds] * Default = 15 seconds [max-age seconds] * Default = 20 seconds
48
Configuring STP Configuring Port Cost (to tweak Path Cost)
Switch(config-if) spanning-tree [vlan vlan-list] cost cost (1-65,535) (lower wins) Configuring Bridge Priority (to tweak BID & root election) Switch(config)# spanning-tree [vlan vlan-list] priority priority * Default = 32,768 (0=65,535)
49
Configuring STP Configuring Port Priority Switch(config)# spanning-tree [vlan vlan-list] priority priority * Default = (0-255) The port with the lowest priority value forwards frames for that vlan. This command can be very useful for load balancing vlans across multiple paths.
50
Verifying STP Switch# show spanning-tree [vlan]
Switch# show spanning-tree mod/num
51
STP Timers
52
STP Timers Forward Delay Timer
The default value of the forward delay (15 seconds) was originally derived assuming a maximum network size of 7 bridge hops, a maximum of three lost BPDUs, and a hello-time interval of 2 seconds. Forward delay is used to determine the length of: Listening state Learning state
53
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 seen. If the device sending this best BPDU fails, it may take 20 seconds the a switch transitions the connected port to Listening.
54
STP Timers Modifying Timers
Do not change the default timer values without careful consideration. Modify the STP timers only from the root bridge The BPDUs contain three fields where the timer values can be passed from the root bridge to all other bridges in the network.
55
STP Timer Example It can take seconds for a switch to adjust to a change in topology.
60
In Figure , bridge A has priority 8192 and
is the root for the VLAN. Bridge B has priority and is the backup root bridge for the same VLAN. Bridges A and B, connected by a Gigabit Ethernet link, make up a core of the network. Bridge C is an access switch and has PortFast configured on the port connected to device D. Given the other STP parameters being default, bridge C port that connects to bridge B will be in STP Blocking state. Device D (PC) is not participating in STP. The red arrows indicate the flow of STP BPDUs.
61
Now, consider that device D started to participate
in STP (for example, a Linux-based bridge application was launched on a PC). If the priority of software bridge is zero or any value below that of root bridge, the software bridge will take over the root bridge function (as bridge with lowest priority), and the Gigabit link connecting the two core switches will transition into blocking mode, thus causing all the data in that particular VLAN to flow via the 100 Mbps link. If there is more data flowing via the core in the VLAN than the link can accommodate, the dropping of frames will occur, leading to a connectivity outage. STP PortFast BPDU guard feature would prevent such a situation by disabling the port as soon as STP BPDU is received from device D.
67
Per-VLAN Spanning Tree Load Balancing
DLSwitch2(config)#spanning-tree vlan 20 root primary
68
Example Hub
69
Not seeing BPDU from Cat-B Ages out BPDU and goes into Listening mode
X Fails Ages out BPDU and goes into Listening mode Hub Cat-B:1/2 fails. Cat-C has no immediate notification because it’s still receiving a link from the hub. Cat-C notices it is not receiving BPDUs from Cat-B. 20 seconds (max age) after the failure, Cat-C ages out the BPDU that lists Cat-B as having the DP for segment 3. This causes Cat-C:1/2 to transition into the Listing state in an effort to become the DP. Hub
70
X Fails Forwarding Mode Listening Mode Hub Because Cat-C:1/2 now offers the most attractive access from the Root Bridge to this link, it eventually transitions all the way into Forwarding mode. In practice this will take 50 seconds (20 max age + 15 Listening + 15 Learning) for Cat-C:1/2 to take over after the failure of Cat-B:1/2. Hub
71
STP Topology Changes The STP change process requires the switch to clear the table faster in order to get rid of unreachable physical addresses. If a switch detects a change, it can send a Topology Change Notification (TCN) BPDU out its root port. The topology change BPDU is forwarded to the root switch, and from there, is propagated throughout the network. TCN does not start a STP recalculation.
72
STP Topology Changes A Bridge originates a TCN BPDU in two conditions:
1. It transitions a port into Forwarding state and it has at lease one Designated Port or Root Port. 2. It transitions a port from either Forwarding or Learning states to the Blocking state. On bridges with Designated Ports accept and process TCN BPDUs. The Root Bridge will send out Configuration BPDUs
73
TCN BPDU Much simpler than a Configuration BPDU.
Only three fields, Protocol ID, Version, and Type (TCN).
74
STP Enhancements Implementation of :
Rapid Spanning Tree Protocol 802.1w (RSTP); Per VLAN Spanning Tree 802.1q (PVST +); Multiple Spanning Tree 802.1s (MST); Load balancing across links; BPDU guard; Root Guard; and Uni-Directional Link Detection (UDLD)
75
RSTP The IEEE 802.1w specification, Rapid Spanning Tree Protocol, provides for subsecond reconvergence of STP after failure of one of the uplinks in a bridged environment. 802.1w provides the structure on which the 802.1s features such as multiple spanning tree operates. There are only three port states left in RSTP corresponding to the three possible operational states Learning ,Forwarding and Discarding. Rapid Transition to Forwarding State is the most important feature introduced by 802.1w: RSTP actively confirms safe port transition to forwarding without relying on timers; There is now a real feedback mechanism that takes place between RSTP-compliant bridges. In order to achieve fast convergence on a port, the protocol relies upon two new variables: edge ports and link type.
76
RSTP The RSTP role is now a variable assigned to a given port:
Root Port Designated Ports Alternate Ports Backup Ports RSTP calculates final topology using exactly the same criteria as 802.1d. There is now a difference between the role the protocol has determined for a port and its current state.
77
When STA selects a port to become a designated port, under 802
When STA selects a port to become a designated port, under 802.1d it waits twice <forward delay> seconds (2x15 by default) before transitioning it to the forwarding state. In RSTP a root bridge aware of a change in the topology, sets the TC flag on the BPDUs it sends out, which are then relayed to all the bridges in the network.
78
BPDU are sent every hello-time (not simply relayed anymore).
A few changes have been introduced by RSTP to the BPDU format. Only two flags, Topology Change (TC) and TC Acknowledgment (TCA), were defined in 802.1d, however RSTP now uses all six remaining bits of the flag byte BPDU are sent every hello-time (not simply relayed anymore). BPDUs are now used as a keep-alive mechanism between bridges. A bridge considers that it has lost connectivity to its direct neighboring root or designated bridge if it misses three BPDUs in a row.
79
The following developments in Spanning Tree Protocol are examined:
Per-VLAN Spanning Tree (PVST) is a Cisco-proprietary implementation requiring ISL trunk encapsulation. PVST+ provides Layer 2 load balancing for the VLAN on which it runs. MST (IEEE 802.1s) extends the IEEE 802.1w Rapid Spanning Tree (RST) algorithm to multiple spanning-trees. Enhanced PVST + or Multiple Instance of Spanning Tree Protocol (MISTP), a compromise between PVST+ and MST
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.