14 RSTP Implementation and Configuration
14 RSTP Implementation and Configuration
Page 1 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Foreword
• On an Ethernet switching network, redundant links are used to implement link backup and enhance
network reliability. The downside of this is that it may produce loops, leading to broadcast storms and an
unstable MAC address table. As a result, communication on the network may deteriorate or even be
interrupted. To prevent loops, IEEE introduced the Spanning Tree Protocol (STP), which is standardized
as IEEE 802.1d.
• The convergence speed of an STP topology slows as the number of LANs increases. Therefore, IEEE
introduced the Rapid Spanning Tree Protocol (RSTP), standardized as 802.1w, in 2001 to improve the
network convergence speed.
• This document describes the improvements of RSTP compared with STP, working mechanism of RSTP,
and RSTP configurations.
Page 2 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Objectives
• Upon completion of this course, you will be able to:
▫ Describe defects of STP technology.
Page 3 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Introduction to RSTP
▪ STP Review and Defects
▫ RSTP Overview
Page 4 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Review: STP Implementation
STP Configuration BPDUs
Page 5 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Review: STP Tree Generation Process
Four Steps of STP Calculation
SW1 (root bridge) • Roles are elected by comparing the following four parameters:
▫ Root bridge ID, root path cost, bridge ID, and port ID
D D
1. Elect the root bridge.
Designated Non-designated ▫ Block all the remaining non-root and non-designated ports on
R Root port D
port port switches.
Page 7 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Review: STP Port State Transition
Blocking 5 2. If the port is selected as the root port or designated port, it enters the
2 Listening state.
3. The port enters the Learning state after the Forward Delay timer
4 Listening 5
expires. After another Forward Delay timer, the port enters the
3 Forward Delay: 15s
Forwarding state.
4 Learning 5
4. If a port is no longer the root port or designated port, it enters the
3 Forward Delay: 15s Blocking state.
Page 8 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Disadvantages of STP
• STP ensures a loop-free network but is slow to converge, leading to service quality deterioration. If the network
topology changes frequently, connections on the STP network are frequently torn down, causing frequent service
interruption.
▪ In terms of port use and configuration, the essential differences between ports lie in the port roles but not port states.
▫ The STP algorithm does not determine topology changes until the timer expires, delaying network convergence.
▫ The STP algorithm requires the root bridge to send configuration BPDUs after the network topology becomes stable, and other
devices process and spread the configuration BPDUs through the entire network. This also delays convergence.
Page 10 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
STP Dependency on Timers
Initialization Terminal Access
SW1 (root bridge)
SW1 (root bridge)
D D
D D
R R
R R D
D SW2 SW3
SW2 SW3
New access device
HostA
In the STP environment, after a terminal or server is connected to the network,
STP uses a timer to prevent temporary loops. After STP elects a port role, even if the port needs to switch from the Disabled state to the Blocking, Listening,
the port is a designated port or a root port, it still needs to wait for two intervals Learning, and Forwarding states in sequence. In this case, HostA needs to wait
of the Forward Delay timer (30s) before forwarding packets. for two intervals of the Forward Delay timer before accessing the network
service.
Page 11 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Slow STP Reconvergence
Direct Link Fault Indirect Link Fault
D D
D D
R R R
D
SW2 SW3
SW2
• Because the blocked port does not receive BPDUs with a higher priority, the port
• The blocked port changes from the Blocking state to the Listening and Learning
changes from Blocking to Listening, Learning, and Forwarding in sequence after 20s.
states in sequence, and finally enters the Forwarding state.
• If the indirect link is faulty, the recovery time is about 50s, which is equal to the value
• If the directly connected link is faulty, the port status changes to Forwarding after of the Max Age timer plus twice the value of the Forward Delay timer.
30s.
Page 12 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
STP Topology Change Mechanism
The STP topology change mechanism transmits topology change information to the root bridge, and then the root bridge
floods the topology change information to downlink devices.
Root bridge Root bridge
n
the DU atio
Delete MAC address entries
et
B P i gu r
it s
DU
to C b
nf
BP
Co
T
1
U on
N
3.
Delete MAC address entries
th PD urati
TC
it
th
to A b
wi
Delete MAC
g
1.
nfi
set e TC
address entries
1
Co
B
th
2.
wi
Send TCN BPDUs and configuration BPDUs with Root bridge sends configuration BPDUs with the Configuration BPDU with the
the TCA bit set to 1 TC bit set to 1 TCA bit set to 1
Configuration BPDU with
the TC bit set to 1
Page 13 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Introduction to RSTP
▫ STP Review and Defects
▪ RSTP Overview
Page 14 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
RSTP Overview
• RSTP defined in IEEE 802.1w was developed based on STP. RSTP optimizes STP in many aspects,
provides a faster convergence speed, and is compatible with STP.
▫ Changes the configuration BPDU format and uses the Flags field to describe port roles.
Page 15 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
RSTP Application on a Campus Network
Internet
Layer 3 network
Layer 2 network
RSTP
... ... ...
Page 16 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Introduction to RSTP
2. Improvements Made in RSTP
3. Working Mechanism of RSTP
4. RSTP Configurations
Page 17 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 1: Port Role
RSTP defines additional port roles to simplify the learning and deployment of the protocol.
R R R R
SW2 SW3 SW2 SW3
D A D B
The alternate port is blocked after learning a configuration BPDU sent by The backup port is blocked after learning a configuration BPDU sent by itself.
another bridge. It is a backup of the root port and provides an alternate path It is a backup of the designated port and provides a backup path from the root
from the designated bridge to the root switch. switch to the corresponding network segment.
Page 18 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 2: Port States
RSTP defines three states, depending on whether a port forwards user traffic and learns MAC addresses.
▫ Discarding: The port does not forward user traffic or learn MAC addresses.
▫ Learning: The port does not forward user traffic but learns MAC addresses.
▫ Forwarding: The port forwards user traffic and learns MAC addresses.
Page 19 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 3: Configuration BPDU
— RST BPDU
• RSTP configuration BPDUs use the Flag field in STP BPDUs to determine the port role.
• RSTP has the following changes except that the format of RSTP is the same as that of STP:
▫ The value of the Type field is changed from 0 to 2. Devices running STP will discard configuration BPDUs sent from devices running RSTP.
▫ The Flags field uses the six bits reserved in STP. This configuration BPDU is called a Rapid Spanning Tree Bridge Protocol Data Unit (RST
BPDU).
bridge.
SW2 SW3
In STP, the root bridge sends configuration BPDUs at an interval of
Hello Time: 2s
Hello Time after the topology becomes stable. Non-root bridges send
Page 21 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 4: Configuration BPDU Processing
(2)
NK
STP needs to wait for the time specified by the Max Age
SW2 SW3
timer.
After 6s, the device
considers the neighbor
invalid and sends its own
RST BPDU.
RST BPDU
Page 22 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 4: Configuration BPDU Processing
(3)
Processing an Inferior BPDU
SW1 (root bridge)
1. If SW2 does not receive any 2. After receiving an inferior BPDU. This speeds up network convergence.
RST BPDU from the uplink BPDU, SW3 compares it with
device, it considers itself as the the cached RST BPDU and
root bridge and sends its own immediately responds with its In STP, only the designated port can process the inferior
BPDU. own RST BPDU.
BPDU immediately.
RST BPDU
Page 23 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 5: Fast Convergence Mechanism (1)
Fast Switchover of the Root Port Fast Switchover of the Designated Port
R Root port R Root port
SW1 (root bridge) SW1 (root bridge)
D Designated port D Designated port
D D D D
A Alternate port B Backup port
R R R R
SW2 SW3 SW2 SW3
D A D B
R D
If a root port fails, the best alternate port becomes the root port and If a designated port fails, the best backup port becomes the
enters the Forwarding state. This is due to the fact that the network designated port and enters the Forwarding state. A backup port
segment connected to this alternate port has a designated port that backs up a designated port and provides a backup path from the
can access the root bridge. root bridge to the related network segment.
Page 24 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 5: Fast Convergence Mechanism (2)
Edge Port
SW1 (root bridge)
Page 25 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 5: Fast Convergence Mechanism (3)
P/A Mechanism
Rapidly enter the
SW1 (root bridge)
Forwarding state
D
• The Proposal/Agreement (P/A for short) mechanism enables
Proposal=1
the uplink port to quickly transition to Forwarding state.
Agreement=1
• In RSTP, after a port is elected as the designated port, the
R port enters the Discarding state and then rapidly enters the
Page 26 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
P/A Mechanism (1)
D
SW2 SW2
A D E A D E
• A link is added between root bridge SW1 and SW2. • The two ports between SW1 and SW2 become
• The three downlink ports of SW2 are the alternate port, designated ports and send RST BPDUs.
Page 27 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
P/A Mechanism (2)
• SW2’s port connected to SW1 receives a superior RST BPDU, so the • After receiving the RST BPDU with the Proposal bit set to 1 from the root
port becomes a root port and stops sending RST BPDUs. bridge, SW2 starts to synchronize all its ports.
• The designated port of SW1 enters the Discarding state and sends an • After all ports are synchronized, all downlink ports (except edge ports)
RST BPDU with the Proposal bit set to 1. enter the Discarding state, and the uplink root port enters the Forwarding
state and returns an RST BPDU with the Agreement bit set to 1 to SW1.
Page 28 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
P/A Mechanism (3)
The RST BPDU with the Agreement bit set to 1 received by SW1 The downlink device continues P/A negotiation.
is a response to the sent RST BPDU with the Proposal bit set to 1
on SW1. Therefore, the designated port immediately enters the
Forwarding state.
Page 29 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 6: Topology Change Mechanism
RSTP considers that the network topology has changed when a non-edge port transitions to the Forwarding
state. Topology Change Mechanism
SW1 (root bridge)
5. Perform steps 2
and 3.
• When detecting a topology change, RSTP devices react as follows:
D D
▫ The local device starts a TC While timer on each non-edge designated port and
1. A link fails.
root port. The TC While timer value is twice the Hello Time value. Within the
TC While time, the local device deletes MAC address entries learned on ports
whose states have changed.
R R ▫ These ports send out RST BPDUs with the TC bit set to 1. When the TC
D A While timer expires, the ports stop sending RST BPDUs.
SW2 SW3
▫ When other switches receive RST BPDUs, they clear MAC address entries
4. Clear the MAC 3. Send RST BPDUs 2. Enable the timer and learned on all their ports except the ports that receive the RST BPDUs. These
addresses learned by with the TC bit set clear the MAC
all ports except the to 1. addresses learned by switches also start a TC While timer on each non-edge designated port and
receive port. the port. repeat the preceding process.
Page 30 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 7: Protection Functions (1)
SW1 (root bridge)
BPDU protection
New device's • BPDU protection enables a switch to set the state of an edge
RST BPDU
port to Error-Down if the edge port receives an RST BPDU. In
this case, the port remains as the edge port, and the switch sends
Device occupied by a a notification to the NMS.
RST BPDU malicious user
Page 31 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 7: Protection Functions (2)
Root protection
SW1 (root bridge)
Enable root
protection • If root protection is enabled on a designated port, the port
D D
role cannot be changed.
Superior
RST BPDU • Once a designated port that is enabled with root protection
receives superior RST BPDUs, the port enters the
Discarding state and does not forward packets. If the port
does not receive any superior RST BPDUs within a
SW2 SW3
Device occupied by a specified period (two intervals of the Forward Delay timer
malicious user
by default), the port automatically enters the Forwarding
state.
RST BPDU • Root protection ensures that the role of the root bridge does
not change due to network problems.
Page 32 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 7: Protection Functions (3)
Loop Prevention
LI
NK
• If the root port or alternate port does not receive BPDUs
SW1 (root bridge) from the uplink device for a long time, the device enabled
D D 1 with loop prevention sends a notification to the NMS. If the
The unidirectional link is
faulty, and packets sent by root port is used, the root port enters the Discarding state
SW1 cannot reach SW3.
and becomes the designated port. If the alternate port is
Loop used, the alternate port keeps blocked and becomes the
3 Enable loop
R R prevention designated port. In this case, loops will not occur.
D A
• After link congestion is cleared or unidirectional link
SW2 SW3 failures are rectified, the port receives BPDUs for
2 The alternate port of SW3 becomes the root port and
enters the Forwarding state. The root port is switched negotiation and restores its original role and status.
to the designated port.
RST BPDU
Page 33 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Improvement 7: Protection Functions (4)
Page 34 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Introduction to RSTP
2. Improvements Made in RSTP
3. Working Mechanism of RSTP
4. RSTP Configurations
Page 35 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
RSTP Topology Convergence Process (1)
BID: 32768.0c-00-00-0a-00-01
SW1
1. After RSTP is enabled on a switch, the switch considers itself as
the root bridge and sends RST BPDUs.
D D
▫ All ports are designated ports and are in Discarding state.
D D
D D
SW2 SW3
Page 36 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
RSTP Topology Convergence Process (2)
2. The uplink quickly enters the Forwarding state through the P/A
mechanism.
SW1 (root bridge)
▫ After receiving a superior RST BPDU, SW2 considers that SW1 is the
D D
root bridge and the port on SW2 becomes the root port instead of the
Proposal=1 designated port. Then SW2 stops sending RST BPDUs.
Uplink ▫ The port on SW1 enters the Discarding state and sends RST BPDUs
Agreement=1 with the Proposal bit set to 1. After receiving the BPDU, SW2 blocks all
R R
ports except the edge port. This process is called synchronization.
SW2 SW3
▫ After ports on SW2 synchronize information, the root port enters the
Downlink Forwarding state and sends an RST BPDU with the Agreement bit set to
1 to SW1. After SW1 receives the BPDU, the designated port
immediately enters the Forwarding state.
RST BPDU Designated port Blocked
R Root port D
port
Page 37 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
RSTP Topology Convergence Process (3)
Designated port Blocked Forwarding state after two intervals of the Forward Delay timer.
RST BPDU R Root port D
port
Page 38 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Introduction to RSTP
2. Improvements Made in RSTP
3. Working Mechanism of RSTP
4. RSTP Configurations
Page 39 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Basic RSTP Configuration Commands (1)
1. Configure a working mode.
The switch supports three working modes: STP, RSTP, and Multiple Spanning Tree Protocol (MSTP). By default, a switch
works in MSTP mode.
2. (Optional) Configure the switch as the root bridge.
By default, a switch does not function as the root bridge of any spanning tree. After you run this command, the priority value of
the switch is set to 0 and cannot be changed.
By default, a switch does not function as the secondary root bridge of any spanning tree. After you run this command, the
priority value of the switch is set to 4096 and cannot be changed.
Page 40 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Basic RSTP Configuration Commands (2)
1. (Optional) Configure the STP priority of a switch.
The value ranges from 0 to 61440, with an increment of 4096. By default, the priority value of a switch is 32768.
Configure a path cost calculation method. By default, the IEEE 802.1t standard (dot1t) is used to calculate the path costs.
All switches on a network must use the same path cost calculation method.
Page 41 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Basic RSTP Configuration Commands (3)
1. (Optional) Configure the interface priority.
The value is an integer that ranges from 0 to 240, with an increment of 16. By default, the priority of a switch port is 128.
Page 42 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
RSTP Protection Configuration Commands (1)
1. Enable BPDU protection on an edge port of a switch.
By default, root protection is disabled on a port. Root protection takes effect only on designated ports. Root protection and loop
prevention cannot be configured on the same port.
Page 43 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
RSTP Protection Configuration Commands (2)
1. Configure TC BPDU attack defense.
Configure the time for a device to process the maximum number of TC BPDUs. By default, the device processes the maximum
number of TC BPDUs at an interval of the Hello timer.
[Huawei] stp tc-protection threshold threshold
Set the number of times that a switch processes received TC BPDUs and updates forwarding entries within a given period of
time. By default, the device processes only one TC BPDU within a specified period of time.
Page 44 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Case: Basic RSTP Configuration (1)
SW1 (root bridge)
Enable RSTP on SW1.
GE
1
0/
0/
[SW1] stp mode rstp
0/
0/
GE
2
[SW1] stp enable
GE
[SW1] stp root primary
1
0/
0/
0/
0/
GE
2
SW2 SW3 Enable RSTP on SW2.
GE0/0/2 GE0/0/1 E
E0/0/1
[SW2] stp mode rstp
[SW2] stp enable
P
[SW2] stp root secondary
• RSTP is configured on the three switches to eliminate Layer C
2 loops.
Page 45 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Case: Basic RSTP Configuration (2)
SW1 (root bridge)
Enable the edge port on SW3.
GE
1
0/
0/
[SW3-Ethernet0/0/1] stp edged-port enable
0/
0/
GE
2
GE
1
0/
0/
0/
0/
Enable root protection on SW1.
GE
2
SW2 GE0/0/2 GE0/0/1 SW3 [SW1-GigabitEthernet0/0/1] stp root-protection
E
E0/0/1 [SW1-GigabitEthernet0/0/2] stp root-protection
P
• RSTP is configured on the three switches to eliminate Layer C
2 loops.
Enable BPDU protection on SW3.
• The configuration roadmap is as follows:
[SW3] stp bpdu-protection
▫ Configure SW1 as the root bridge and SW2 as the secondary root bridge.
▫ Configure the port connected to the PC as the edge port because this port does not
participate in RSTP calculation.
Page 46 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Quiz
1. (Multiple) Which of the following are RSTP port states? ( )
A. Idle
B. Discarding
C. Forwarding
D. Learning
2. (TorF) RSTP root protection must be configured on the root port of the device. ( )
Page 47 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Summary
• STP prevents loops on a LAN. Devices running STP exchange information with one another to
discover loops on the network, and block certain ports to eliminate loops. With the growth in
scale of LANs, STP has become an important protocol for a LAN.
• Based on STP, RSTP has many improvements and greatly speeds up network convergence.
• This document describes seven improvements of RSTP compared with STP, including the port
role, port status, BPDU format, BPDU processing mode, fast convergence mechanism, topology
change mechanism, and four protection features.
Page 48 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
谢谢
Thank You
www.huawei.com
Page 49 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.