0% found this document useful (0 votes)
11 views

06 STP Principles and Configuration

The document outlines the principles and configuration of the Spanning Tree Protocol (STP) as implemented by Huawei Technologies. It explains the importance of STP in preventing loops in Layer 2 networks, the basic concepts of STP, and its operational mechanisms, including the roles of the root bridge and port costs. Additionally, it discusses improvements made in Rapid Spanning Tree Protocol (RSTP) and provides guidance on basic STP configurations.

Uploaded by

mulugetahemen5
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

06 STP Principles and Configuration

The document outlines the principles and configuration of the Spanning Tree Protocol (STP) as implemented by Huawei Technologies. It explains the importance of STP in preventing loops in Layer 2 networks, the basic concepts of STP, and its operational mechanisms, including the roles of the root bridge and port costs. Additionally, it discusses improvements made in Rapid Spanning Tree Protocol (RSTP) and provides guidance on basic STP configurations.

Uploaded by

mulugetahemen5
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 39

STP Principles and

Configuration

Huawei Technologies Co., Ltd.

Copyright © Huawei Technologies Co., Ltd. 2020. All rights reserved.


No part of this document may be reproduced or transmitted in any form or by any means
without prior written consent of Huawei Technologies Co., Ltd.

Trademarks and Permissions

and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.
All other trademarks and trade names mentioned in this document are the property of their
respective holders.

Notice
The purchased products, services and features are stipulated by the contract made
between Huawei and the customer. All or part of the products, services and features
described in this document may not be within the purchase scope or the usage scope.
Unless otherwise specified in the contract, all statements, information, and
recommendations in this document are provided "AS IS" without warranties, guarantees or
representations of any kind, either express or implied.
The information in this document is subject to change without notice. Every effort has been
made in the preparation of this document to ensure accuracy of the contents, but all
statements, information, and recommendations in this document do not constitute a
warranty of any kind, express or implied.

Huawei Technologies Co., Ltd.


Address: Huawei Industrial Base
Bantian, Longgang
Shenzhen 518129
People's Republic of China

Website: https://e.huawei.com/
Huawei Certification System
Huawei Certification follows the "platform + ecosystem" development strategy,
which is a new collaborative architecture of ICT infrastructure based on "Cloud-
Pipe-Terminal". Huawei has set up a complete certification system consisting of
three categories: ICT infrastructure certification, platform and service
certification, and ICT vertical certification. It is the only certification system that
covers all ICT technical fields in the industry. Huawei offers three levels of
certification: Huawei Certified ICT Associate (HCIA), Huawei Certified ICT
Professional (HCIP), and Huawei Certified ICT Expert (HCIE). Huawei
Certification covers all ICT fields and adapts to the industry trend of ICT
convergence. With its leading talent development system and certification
standards, it is committed to fostering new ICT talent in the digital era, and
building a sound ICT talent ecosystem.
Huawei Certified ICT Associate-Datacom (HCIA-Datacom) is designed for
Huawei's frontline engineers and anyone who want to understand Huawei's
datacom products and technologies. The HCIA-Datacom certification covers
routing and switching principles, basic WLAN principles, network security
basics, network management and O&M basics, SDN and programmability and
automation basics.
The Huawei certification system introduces the industry, fosters innovation,
and imparts cutting-edge datacom knowledge.
Contents

1 STP Principles and Configuration....................................................1


1.1 Foreword............................................................................................................................... 1
1.2 Objectives.............................................................................................................................. 1
1.3 STP Overview......................................................................................................................... 2
1.3.1 Technical Background: Redundancy and Loops on a Layer 2 Switching Network...............2
1.3.2 Technical Background: Layer 2 Loops Caused by Human Errors........................................3
1.3.3 Issues Caused by Layer 2 Loops.........................................................................................3
1.3.4 Introduction to STP............................................................................................................. 5
1.3.5 STP Can Dynamically Respond to Network Topology Changes and Adjust Blocked Ports. . .5
1.3.6 Q&A: Layer 2 and Layer 3 loops.........................................................................................6
1.3.7 Application of STP on a Campus Network...........................................................................7
1.3.8 STP Overview...................................................................................................................... 7
1.4 Basic Concepts and Working Mechanism of STP....................................................................7
1.4.1 STP Basic Concepts............................................................................................................ 7
1.4.2 Format of Configuration BPDUs........................................................................................12
1.4.3 BPDU Comparison Rules................................................................................................... 13
1.4.4 Configuration BPDU Forwarding Process...........................................................................15
1.4.5 STP Calculation................................................................................................................. 15
1.4.6 Quiz 1: Identify the Root Bridge and Port Roles................................................................19
1.4.7 Quiz 2: Identify the Root Bridge and Port Roles in the Following Topology.......................20
1.4.8 Quiz 3: Identify the Root Bridge and Port Roles in the Following Topology.......................20
1.4.9 STP Port States................................................................................................................. 21
1.4.10 STP Port State Transition................................................................................................ 21
1.4.11 Topology Change............................................................................................................ 22
1.4.12 The MAC Address Table Is Incorrect Because the Topology Changes.............................25
1.5 Basic STP Configurations..................................................................................................... 26
1.5.1 Basic STP Configuration Commands.................................................................................26
1.5.2 Case 1: Basic STP Configurations......................................................................................27
1.6 Improvements Made in RSTP............................................................................................... 28
1.6.1 Disadvantages of STP....................................................................................................... 28
1.6.2 RSTP Overview................................................................................................................. 29
1.6.3 Improvements Made in RSTP............................................................................................29
1.6.4 Port Roles in RSTP............................................................................................................ 30
1.6.5 Edge Port.......................................................................................................................... 30
1.6.6 Port States in RSTP........................................................................................................... 31
1.7 STP Advancement................................................................................................................ 31
1.7.1 Defects of STP/RSTP: All VLANs Share One Spanning Tree...............................................31
1.7.2 VBST................................................................................................................................. 32
1.7.3 MSTP................................................................................................................................. 32
1.7.4 Stack and Tree Networking of Campus Networks.............................................................33
1.7.5 Smart Link........................................................................................................................ 34
1.8 Quiz..................................................................................................................................... 35
1.9 Summary............................................................................................................................. 36
STP Principles and Configuration Page 1

1 STP Principles and


Configuration

1.1 Foreword
On an Ethernet switching network, redundant links are used to implement link
backup and enhance network reliability. However, the use of redundant links
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).
Devices running STP exchange STP Bridge Protocol Data Units (BPDUs) to
discover loops on the network and block appropriate ports. This enables a ring
topology to be trimmed into a loop-free tree topology, preventing infinite looping
of packets and ensuring packet processing capabilities of devices.
IEEE introduced the Rapid Spanning Tree Protocol (RSTP) to improve the network
convergence speed.

1.2 Objectives
On completion of this course, you will be able to:
 Describe the causes and problems of Layer 2 loops on a campus switching
network.
 Describe basic concepts and working mechanism of STP.
 Distinguish STP from RSTP and describe the improvement of RSTP on STP.
 Complete basic STP configurations.
 Understand other methods to eliminate Layer 2 loops on the switching
network except STP.
STP Principles and Configuration Page 2

1.3 STP Overview


1.3.1 Technical Background: Redundancy and Loops on a
Layer 2 Switching Network

Figure 1-1 A network without redundancy design

Figure 1-2 Layer 2 loops introduced along with redundancy


As LANs increase, more and more switches are used to implement
interconnection between hosts. As shown in the figure, the access switch is
connected to the upstream device through a single link. If the uplink fails, the
host connected to the access switch is disconnected from the network. Another
problem is the single point of failure (SPOF). That is, if the switch breaks down,
the host connected to the access switch is also disconnected.
To solve this problem, switches use redundant links to implement backup.
Although redundant links improve network reliability, loops may occur. Loops
cause many problems, such as communication quality deterioration and
communication service interruption.
STP Principles and Configuration Page 3

1.3.2 Technical Background: Layer 2 Loops Caused by


Human Errors

Figure 1-1 Case 1

Figure 1-2 Case 2


In practice, redundant links may cause loops, and some loops may be caused by
human errors.

1.3.3 Issues Caused by Layer 2 Loops

Figure 1-1 Typical Issue 1: Broadcast Storm


Issue 1: Broadcast storm
STP Principles and Configuration Page 4

 According to the forwarding principle of switches, if a switch receives a


broadcast frame or a unicast frame with an unknown destination MAC
address from an interface, the switch forwards the frame to all other
interfaces except the source interface. If a loop exists on the switching
network, the frame is forwarded infinitely. In this case, a broadcast storm
occurs and repeated data frames are flooded on the network.
 In this example, SW3 receives a broadcast frame and floods it. SW1 and SW2
also forward the frame to all interfaces except the interface that receives the
frame. As a result, the frame is forwarded to SW3 again. This process
continues, causing a broadcast storm. The switch performance deteriorates
rapidly and services are interrupted.

Figure 1-2 Typical Issue 2: MAC Address Flapping


Issue 2: MAC address flapping
 A switch generates a MAC address table based on source addresses of
received data frames and receive interfaces.
 In this example, SW1 learns and floods the broadcast frame after receiving it
from GE0/0/1, forming the mapping between the MAC address 5489-98EE-
788A and GE0/0/1. SW2 learns and floods the received broadcast frame. SW1
receives the broadcast frame with the source MAC address 5489-98EE-788A
from GE0/0/2 and learns the MAC address again. Then, the MAC address
5489-98EE-788A is switched between GE0/0/1 and GE0/0/2 repeatedly,
causing MAC address flapping.

1.3.4 Introduction to STP


STP Principles and Configuration Page 5

Figure 1-1 STP


When STP is deployed on a network, switches exchange STP BPDUs and calculate
a loop-free topology. Finally, one or more ports on the network are blocked to
eliminate loops.
On an Ethernet network, loops on a Layer 2 network may cause broadcast
storms, MAC address flapping, and duplicate data frames. STP is used to prevent
loops on a switching network.
STP constructs a tree to eliminate loops on the switching network.
The STP algorithm is used to detect loops on the network, block redundant links,
and prune the loop network into a loop-free tree network. In this way,
proliferation and infinite loops of data frames are avoided on the loop network.

1.3.5 STP Can Dynamically Respond to Network Topology


Changes and Adjust Blocked Ports

Figure 1-1 STP


STP running on a switch continuously monitors the network topology. When the
network topology changes, STP can detect the changes and automatically adjust
the network topology.
Therefore, STP can solve the Layer 2 loop problem and provide a solution for
network redundancy.
As shown in the preceding figure, switches run STP and exchange STP BPDUs to
monitor the network topology. Normally, a port on SW3 is blocked to prevent the
loop. When the link between SW1 and SW3 is faulty, the blocked port is
unblocked and enters the forwarding state.

1.3.6 Q&A: Layer 2 and Layer 3 loops


STP Principles and Configuration Page 6

Figure 1-1 Layer 3 loop

Figure 1-2 Layer 2 loop


Common loops are classified into Layer 2 and Layer 3 loops.
Layer 2 loops are caused by Layer 2 redundancy or incorrect cable connections.
You can use a specific protocol or mechanism to prevent Layer 2 loops.
Layer 3 loops are mainly caused by routing loops. Dynamic routing protocols can
be used to prevent loops and the TTL field in the IP packet header can be used to
prevent packets from being forwarded infinitely.

1.3.7 Application of STP on a Campus Network

Figure 1-1 Application of STP on a campus network


STP is used on Layer 2 networks of campus networks to implement link backup
and eliminate loops.

1.3.8 STP Overview


STP is used on a LAN to prevent loops.
Devices running STP exchange information with one another to discover loops on
the network, and block certain ports to eliminate loops.
After running on a network, STP continuously monitors the network status. When
the network topology changes, STP can detect the change and automatically
respond to the change. In this way, the network status can adapt to the new
topology, ensuring network reliability.
STP Principles and Configuration Page 7

With the growth in scale of LANs, STP has become an important protocol for a
LAN.

1.4 Basic Concepts and Working Mechanism of STP


1.4.1 STP Basic Concepts
1、BID

Figure 1-1 BID


Bridge ID (BID)
 As defined in IEEE 802.1D, a BID consists of a 16-bit bridge priority and a
bridge MAC address.
 Each switch running STP has a unique BID.
 The bridge priority occupies the leftmost 16 bits and the MAC address
occupies the rightmost 48 bits.
 On an STP network, the device with the smallest BID acts as the root bridge.
In STP, each switch has a bridge ID (BID), which consists of a 16-bit bridge
priority and a 48-bit MAC address. On an STP network, the bridge priority is
configurable and ranges from 0 to 65535. The default bridge priority is 32768.
The bridge priority can be changed but must be a multiple of 4096. The device
with the highest priority (a smaller value indicates a higher priority) is selected
as the root bridge. If the priorities are the same, devices compare MAC
addresses. A smaller MAC address indicates a higher priority.
As shown in the figure, the root bridge needs to be selected on the network. The
three switches first compare bridge priorities. The bridge priorities of the three
switches are 4096. Then the three switches compare MAC addresses. The switch
with the smallest MAC address is selected as the root bridge.
2、Root Bridge
STP Principles and Configuration Page 8

Figure 1-2 Root Bridge


Root Bridge
 One of the main functions of STP is to calculate a loop-free STP tree on the
entire switching network.
 The root bridge is the root of an STP network.
 After STP starts to work, it elects a root bridge on the switching network. The
root bridge is the key for topology calculation of the spanning tree and is the
root of the loop-free topology calculated by STP.
 On an STP network, the device with the smallest BID acts as the root bridge.
 During BID comparison, devices first compare bridge priorities. A smaller
priority value indicates a higher priority of a device. The switch with the
smallest priority value becomes the root bridge. If priority values are the
same, the switch with the smallest MAC address becomes the root bridge.
The root bridge functions as the root of a tree network.
It is the logical center, but not necessarily the physical center, of the network.
The root bridge changes dynamically with the network topology.
After network convergence is completed, the root bridge generates and sends
configuration BPDUs to other devices at specific intervals. Other devices process
and forward the configuration BPDUs to notify downstream devices of topology
changes, ensuring that the network topology is stable.
3、Cost

Figure 1-3 Cost


Cost
STP Principles and Configuration Page 9

 Each STP-enabled port maintains a cost. The cost of a port is used to


calculate the root path cost (RPC), that is, the cost of the path to the root.
 The default cost of a port is related to the rate, working mode, and STP cost
calculation method used by a switch.
 A higher port bandwidth indicates a smaller cost.
 You can also run commands to adjust the cost of a port as required.
Each port on a switch has a cost in STP. By default, a higher port bandwidth
indicates a smaller port cost.
Huawei switches support multiple STP path cost calculation standards to provide
better compatibility in scenarios where devices from multiple vendors are
deployed. By default, Huawei switches use IEEE 802.1t to calculate the path cost.
4、Cost Calculation Methods

Table 1-1 Cost Calculation Methods


Recommended STP Cost

Port Rate Port Mode Huawei


IEEE 802.1d-
IEEE 802.1t Legacy
1998
Standard

Half-duplex 19 200,000 200

Full-duplex 18 199,999 199


100 Mbit/s
Aggregated
15 100,000 180
link: two ports

Full-duplex 4 20,000 20
1000 Mbit/s Aggregated
3 10,000 18
link: two ports

Full-duplex 2 2000 2
10 Gbit/s Aggregated
1 1000 1
link: two ports

Full-duplex 1 500 1
40 Gbit/s Aggregated
1 250 1
link: two ports

Full-duplex 1 200 1
100 Gbit/s Aggregated
1 100 1
link: two ports

The cost has a default value and is associated with the port rate. When the
device uses different algorithms, the same port rate corresponds to different cost
values.
5、RPC
STP Principles and Configuration Page 10

Figure 1-4 RPC


RPC
 The cost from a switch port to the root bridge, that is, RPC, is important
during STP topology calculation.
 The RPC from a port to the root bridge is the sum of costs of all inbound
ports along the path from the root bridge to the device.
 In this example, the RPC for SW3 to reach the root bridge through GE0/0/1 is
equal to the cost of port 1 plus the cost of port 2.
There may be multiple paths from a non-root bridge to the root bridge. Each path
has a total cost, which is the sum of all port costs on this path. A non-root bridge
compares the costs of multiple paths to select the shortest path to the root
bridge. The path cost of the shortest path is called the root path cost (RPC), and
a loop-free tree network is generated. The RPC of the root bridge is 0.
6、PID

Figure 1-5 PID


Port ID (PID)
 An STP-enabled switch uses PIDs to identify ports. A PID is used to elect a
designated port in a specific scenario.
 A PID consists of the leftmost four bits (port priority) and the rightmost 12
bits (port number).
 An STP-enabled port maintains a default port priority, which is 128 on
Huawei switches. You can run a command to change the priority as required.
STP Principles and Configuration Page 11

Each port on an STP-enabled switch has a port ID, which consists of the port
priority and port number. The value of the port priority ranges from 0 to 240,
with an increment of 16. That is, the value must be an integer multiple of 16. By
default, the port priority is 128. The PID is used to determine the port role.
7、BPDU

Figure 1-6 BPDU


Bridge Protocol Data Unit (BPDU)
 BPDU is the basis for STP to work normally.
 STP-enabled switches exchange BPDUs that carry important information.
 There are two types of BPDUs:
 Configuration BPDU
 Topology Change Notification (TCN) BPDU
 Configuration BPDUs are the key to STP topology calculation. TCN BPDUs are
triggered only when the network topology changes.
Switches exchange BPDUs where information and parameters are encapsulated
to calculate spanning trees.
BPDUs are classified into configuration BPDUs and TCN BPDUs.
A configuration BPDU contains parameters such as the BID, path cost, and PID.
STP selects the root bridge by transmitting configuration BPDUs between
switches and determines the role and status of each switch port. Each bridge
proactively sends configuration BPDUs during initialization. After the network
topology becomes stable, only the root bridge proactively sends configuration
BPDUs. Other bridges send configuration BPDUs only after receiving
configuration BPDUs from upstream devices.
A TCN BPDU is sent by a downstream switch to an upstream switch when the
downstream switch detects a topology change.

1.4.2 Format of Configuration BPDUs

Figure 1-1 BPDU


Table 1-1 BPDU
Byt Field Description
STP Principles and Configuration Page 12

2 PID For STP, the value of this field is always 0.

1 PVI For STP, the value of this field is always 0.

Type of BPDUs. The value 0x00 indicates a configuration


1 BPDU Type
BPDU and the value 0x80 indicates a TCN BPDU.

STP uses only the leftmost two bits and the rightmost two
1 Flags bits: Topology Change Acknowledgment (TCA) and
Topology Change (TC).

8 Root D BID of the root bridge.

STP cost of the path from the current port to the root
4 RPC
bridge.

8 Bridge ID BID of the sender.

ID of the port that sends this BPDU, which consists of the


2 Port ID
port priority and port number.
Number of seconds after a BPDU is sent from the root
Message bridge. The value increases by 1 each time the BPDU
2
Age passes through a network bridge. It refers to the number
of hops to the root bridge.
If the bridge does not receive any BPDU for a period of
time and the lifetime of the network bridge reaches the
2 Max Age maximum, the network bridge considers that the link
connected to the port is faulty.
The default value is 20s.

Interval at which the root bridge sends configuration


2 Hello Time
BPDUs. The default value is 2s.

Forward Time that is spent in Listening or Learning state. The


2
Delay default value is 15s.

1.4.3 BPDU Comparison Rules


Table 1-1 Field
Field

Protocol Identifier

Protocol Version Identifier

BPDU Type

Flags

Root Identifier

Root Path Cost


STP Principles and Configuration Page 13

Bridge Identifier

Port Identifier

Message Age

Max Age

Hello Time

Forward Delay

The core of STP is to calculate a loop-free topology on a switching network.


During topology calculation, the comparison of configuration BPDUs is important.
The Root Identifier, Root Path Cost, Bridge Identifier, and Port Identifier fields are
the main fields of a configuration BPDU. STP-enabled switches compare the four
fields.
STP selects the optimal configuration BPDU in the following sequence:
 Smallest BID of the root bridge
 Smallest RPC
 Smallest BID of the network bridge
 Smallest PID
Among the four rules (each rule corresponds to a field in a configuration BPDU),
the first rule is used to elect the root bridge on the network, and the following
rules are used to elect the root port and designated port.
 STP operations:
 Selects a root bridge.
 Each non-root switch elects a root port.
 Select a designated port for each network segment.
Blocks non-root and non-designated ports.
STP defines three port roles: designated port, root port, and alternate port.
A designated port is used by a switch to forward configuration BPDUs to the
connected network segment. Each network segment has only one designated
port. In most cases, each port of the root bridge is a designated port.
The root port is the port on the non-root bridge that has the optimal path to the
root bridge. A switch running STP can have only one root port, but the root
bridge does not have any root port.
If a port is neither a designated port nor a root port, the port is an alternate port.
The alternate port is blocked.
STP Principles and Configuration Page 14

1.4.4 Configuration BPDU Forwarding Process

Figure 1-1 Configuration BPDU Forwarding Process


When a switch starts, it considers itself as the root bridge and sends
configuration BPDUs to each other for STP calculation.

1.4.5 STP Calculation


1、Select a Root Bridge on the Switching Network

Figure 1-1 Select a Root Bridge on the Switching Network


Select a Root Bridge on the Switching Network
 After STP starts to work on a switching network, each switch sends
configuration BPDUs to the network. The configuration BPDU contains the
BID of a switch.
 The switch with the smallest bridge ID becomes the root bridge.
 Only one root bridge exists on a contiguous STP switching network.
 The role of the root bridge can be preempted.
 To ensure the stability of the switching network, you are advised to plan the
STP network in advance and set the bridge priority of the switch that is
planned as the root bridge to the minimum value 0.
What is a root bridge?
 The root bridge is the root node of an STP tree.
STP Principles and Configuration Page 15

 To generate an STP tree, first determine a root bridge.


 It is the logical center, but not necessarily the physical center, of the
network.
 When the network topology changes, the root bridge may also change. (The
role of the root bridge can be preempted.)
Election process:
 When an STP-enabled switch is started, it considers itself as the root bridge
and declares itself as the root bridge in the BPDUs sent to other switches. In
this case, the BID in the BPDU is the BID of each device.
 When a switch receives a BPDU from another device on the network, it
compares the BID in the BPDU with its own BID.
 Switches exchange BPDUs continuously and compare BIDs. The switch with
the smallest BID is selected as the root bridge, and other switches are non-
root bridges.
 As shown in the figure, the priorities of SW1, SW2, and SW3 are compared
first. If the priorities of SW1, SW2, and SW3 are the same, MAC addresses are
compared. The BID of SW1 is the smallest, so SW1 is the root bridge, and
SW2 and SW3 are non-root bridges.
Note:
The role of the root bridge can be preempted. When a switch with a smaller BID
joins the network, the network performs STP calculation again to select a new
root bridge.
2、Select a Root Port on Each Non-root Bridge

Figure 1-2 Select a Root Port on Each Non-root Bridge


Select a Root Port on Each Non-root Bridge
 Each non-root bridge selects a root port from its ports.
 A non-root bridge has only one root port.
 When a non-root-bridge switch has multiple ports connected to the network,
the root port receives the optimal configuration BPDU.
 The root port is located on each non-root bridge and has the shortest
distance away from the root bridge.
What is a root port?
STP Principles and Configuration Page 16

 A non-root bridge may have multiple ports connected to a network. To


ensure that a working path from a non-root bridge to a root bridge is optimal
and unique, the root port needs to be determined among ports of the non-
root bridge. The root port is used for packet exchange between the non-root
bridge and the root bridge.
 After the root bridge is elected, the root bridge still continuously sends
BPDUs, and the non-root bridge continuously receives BPDUs from the root
bridge. Therefore, the root port closest to the root bridge is selected on all
non-root bridges. After network convergence, the root port continuously
receives BPDUs from the root bridge.
 That is, the root port ensures the unique and optimal working path between
the non-root bridge and the root bridge.
Note: A non-root bridge can have only one root port.
Election process:
 A switch has multiple ports connected to a network. Each port receives a
BPDU carrying main fields such as RootID, RPC, BID, and PID. The ports
compare these fields.
 First, RPCs are compared.STP uses the RPC as an important basis to
determine the root port. A smaller RPC indicates a higher priority of selecting
the root port. Therefore, the switch selects the port with the smallest RPC as
the root port.
 When the RPCs are the same, BIDs in the BPDUs received by ports of a
switch are compared. A smaller BID indicates a higher priority of electing the
root port, so the switch selects the port with the smallest BID as the root
port.
 When the BIDs are the same, PIDs in the BPDUs received by ports of a switch
are compared. A smaller PID indicates a higher priority of electing the root
port, so the switch selects the port with the smallest PID as the root port.
 When the PIDs are the same, PIDs of ports on the local switch are compared.
A smaller PID indicates a higher priority of electing the root port, so the
switch selects the port with the smallest PID as the root port.
3、A designated port is elected on each link.

Figure 1-3 A designated port is elected on each link


A designated port is elected on each link.
 After the root port is elected, the non-root bridge uses the optimal BPDU
received on the port to calculate the configuration BPDU and compares the
STP Principles and Configuration Page 17

calculated configuration BPDU with the configuration BPDUs received by all


ports except the root port.
 If the former is better, the port is a designated port.
 If the latter is better, the port is not a designated port.
 In most cases, all ports on the root bridge are designated ports.
What is a designated port?
 The working path between each link and the root bridge must be unique and
optimal. When a link has two or more paths to the root bridge (the link is
connected to different switches, or the link is connected to different ports of
a switch), the switch (may be more than one) connected to the link must
determine a unique designated port.
 Therefore, a designated port is selected for each link to send BPDUs along
the link.
Note: Generally, the root bridge has only designated ports.
Election process:
 The designated port is also determined by comparing RPCs. The port with the
smallest RPC is selected as the designated port. If the RPCs are the same,
the BID and PID are compared.
 First, RPCs are compared.A smaller value indicates a higher priority of
electing the designated port, so the switch selects the port with the smallest
RPC as the designated port.
 If the RPCs are the same, BIDs of switches at both ends of the link are
compared. A smaller BID indicates a higher priority of electing the
designated port, so the switch selects the port with the smallest BID as the
designated port.
 If the BIDs are the same, PIDs of switches at both ends of the link are
compared. A smaller PID indicates a higher priority of electing the designated
port, so the switch selects the port with the smallest PID as the designated
port.
4、Block Non-designated Port

Figure 1-4 Block Non-designated Port


Block Non-designated Port
 On a switch, a port that is neither a root port nor a designated port is called a
non-designated port.
STP Principles and Configuration Page 18

 The last step of STP operations is to block the non-designated port on the
network. After this step is complete, the Layer 2 loop on the network is
eliminated.
What is a non-designated port (alternate port)?
 After the root port and designated port are determined, all the remaining
non-root ports and non-designated ports on the switch are called alternate
ports.
Blocking alternate ports
 STP logically blocks the alternate ports. That is, the ports cannot forward the
frames (user data frames) generated and sent by terminal computers.
 Once the alternate port is logically blocked, the STP tree (loop-free topology)
is generated.
Note:
 The blocked port can receive and process BPDUs.
 The root port and designated port can receive and send BPDUs and forward
user data frames.

1.4.6 Quiz 1: Identify the Root Bridge and Port Roles

Figure 1-1 Quiz 1


As shown in the figure, the root bridge is selected first. If the three switches have
the same bridge priority, the switch with the smallest MAC address is selected as
the root bridge.
GE0/0/1 on SW2 is closest to the root bridge and has the smallest RPC, so
GE0/0/1 on SW2 is the root port. Similarly, GE0/0/1 on SW3 is also the root port.
Then designated ports are selected. SW1 is elected as the root bridge, so
GE0/0/0 and GE0/0/1 on SW1 are designated ports. GE0/0/2 on SW2 receives
configuration BPDUs from SW3 and compares the BIDs of SW2 and SW3. SW2
has a higher BID than SW3, so GE0/0/2 on SW2 is the designated port.
GE0/0/2 on SW3 is the alternate port.
STP Principles and Configuration Page 19

1.4.7 Quiz 2: Identify the Root Bridge and Port Roles in the
Following Topology

Figure 1-1 Quiz 2


As shown in the figure, the root bridge is selected first. If the four switches have
the same bridge priority, the switch with the smallest MAC address is selected as
the root bridge.
GE0/0/1 on SW2 is closest to the root bridge and has the smallest RPC.
Therefore, GE0/0/1 on SW2 is the root port. Similarly, GE0/0/2 on SW3 is the root
port. The two ports on SW4 have the same RPC. The BID of SW2 connected to
GE0/0/1 on SW4 and the BID of SW3 connected to GE0/0/2 on SW4 are
compared. The smaller the BID, the higher the priority. Given this, GE0/0/1 on
SW4 is selected as the root port.
Then designated ports are selected. SW1 is elected as the root bridge, so
GE0/0/0 and GE0/0/1 on SW1 are designated ports. GE0/0/2 on SW2 receives
configuration BPDUs from SW4 and compares the RPCs of SW2 and SW4. SW2
has a smaller RPC than SW4, so GE0/0/2 on SW2 is the designated port, and
GE0/0/1 on SW3 is the designated port.
GE0/0/2 on SW4 is the alternate port.

1.4.8 Quiz 3: Identify the Root Bridge and Port Roles in the
Following Topology

Figure 1-1 Quiz 3


As shown in the figure, the root bridge is selected first. If the two switches have
the same bridge priority, the switch with a smaller MAC address is selected as
the root bridge. SW1 is selected as the root bridge.
Then the root port is selected. The two ports on SW2 have the same RPC and
BID. The PIDs of the two ports are compared. The PID of G0/0/1 on SW2 is 128.1,
and the PID of G0/0/2 on SW2 is 128.2. The smaller the PID, the higher the
priority. Therefore, G0/0/1 of SW2 is the root port.
SW1 is the root bridge, so GE0/0/1 and GE0/0/2 on SW1 are designated ports.
GE0/0/2 on SW2 is the alternate port.
STP Principles and Configuration Page 20

1.4.9 STP Port States


Table 1-1 STP Port States
Port State Description

The port cannot send or receive BPDUs or service data frames.


Disabled
That is, the port is Down.

The port is blocked by STP. A blocked port cannot send BPDUs


Blocking but listens to BPDUs. In addition, the blocked port cannot send
or receive service data frames or learn MAC addresses.

STP considers the port in Listening state as the root port or


designated port, but the port is still in the STP calculation
Listening process. In this case, the port can send and receive BPDUs but
cannot send or receive service data frames or learn MAC
addresses.

A port in Learning state listens to service data frames but


Learning cannot forward them. After receiving service data frames, the
port learns MAC addresses.

A port in Forwarding state can send and receive service data


Forwarding frames and process BPDUs. Only the root port or designated
port can enter the Forwarding state.

1.4.10 STP Port State Transition

Figure 1-1 STP Port State Transition


1. When a port is initialized or activated, it automatically enters the blocking
state.
2. The port is elected as the root port or designated port and automatically
enters the Listening state.
3. The Forward Delay timer expires and the port is still the root port or
designated port.
4. The port is no longer the root port or designated port.
5. The port is disabled or the link fails.
STP Principles and Configuration Page 21

The figure shows the STP port state transition. The STP-enabled device has the
following five port states:
Forwarding: A port can forward user traffic and BPDUs. Only the root port or
designated port can enter the Forwarding state.
Learning: When a port is in Learning state, a device creates MAC address entries
based on user traffic received on the port but does not forward user traffic
through the port. The Learning state is added to prevent temporary loops.
Listening: A port in Listening state can forward BPDUs, but cannot forward user
traffic.
Blocking: A port in Blocking state can only receive and process BPDUs, but
cannot forward BPDUs or user traffic. The alternate port is in Blocking state.
Disabled: A port in Disabled state does not forward BPDUs or user traffic.

1.4.11 Topology Change


1、Root Bridge Fault

Figure 1-1 Root Bridge Fault Rectification Process


1) SW1 (root bridge) is faulty and stops sending BPDUs.
2) SW2 waits for the Max Age timer (20s) to expire. In this case, the record
about the received BPDUs becomes invalid, and SW2 cannot receive new
BPDUs from the root bridge. SW2 learns that the upstream device is faulty.
3) Non-root bridges send configuration BPDUs to each other to elect a new root
bridge.
4) After re-election, port A of SW3 transitions to the Forwarding state after two
intervals of the Forward Delay timer (the default interval is 15s).
 A non-root bridge starts root bridge re-election after BPDUs age.
 Due to the root bridge failure, it takes about 50s to recover from a root
bridge failure.
Root bridge fault:
 On a stable STP network, a non-root bridge periodically receives BPDUs from
the root bridge.
 If the root bridge fails, the downstream switch stops sending BPDUs. As a
result, the downstream switch cannot receive BPDUs from the root bridge.
 If the downstream switch does not receive BPDUs, the Max Age timer (the
default value is 20s) expires. As a result, the record about the received
STP Principles and Configuration Page 22

BPDUs becomes invalid. In this case, the non-root bridges send configuration
BPDUs to each other to elect a new root bridge.
Port state:
 The alternate port of SW3 enters the Listening state from the Blocking state
after 20s and then enters the Learning state. Finally, the port enters the
Forwarding state to forward user traffic.
Convergence time:
 It takes about 50s to recover from a root bridge failure, which is equal to the
value of the Max Age timer plus twice the value of the Forward Delay timer.
2、Direct Link Fault

Figure 1-2 Direct Link Fault Rectification Process


 On a stable network, when SW2 detects that the link of the root port is faulty,
the alternate port of SW2 enters the Forwarding state after twice the value of
the Forward Delay timer (the default value is 15s).
 After SW2 detects a fault on the direct link, it switches the alternate port
to the root port.
 If a direct link fails, the alternate port restores to the Forwarding state
after 30s.
Direct link fault:
 When two switches are connected through two links, one is the active link
and the other is the standby link.
 When the network is stable, SW2 detects that the link of the root port is
faulty, and the alternate port enters the Forwarding state.
Port state:
 The alternate port transitions from the Blocking state to the Listening,
Learning, Forwarding states in sequence.
Convergence speed:
 If a direct link fails, the alternate port restores to the Forwarding state after
30s.
3、Indirect Link Fault
 When the indirect link fails, the alternate port on SW3 restores to the
Forwarding state. It takes about 50s to recover from an indirect link failure.
STP Principles and Configuration Page 23

Figure 1-3 Indirect Link Fault


Indirect link fault:
 On a stable STP network, a non-root bridge periodically receives BPDUs from
the root bridge.
 If the link between SW1 and SW2 is faulty (not a physical fault), SW2 cannot
receive BPDUs from SW1. The Max Age timer (the default value is 20s)
expires. As a result, the record about the received BPDUs becomes invalid.
 In this case, the non-root bridge SW2 considers that the root bridge fails and
considers itself as the root bridge. Then SW2 sends its own configuration
BPDU to SW3 to notify SW3 that it is the new root bridge.
 During this period, the alternate port of SW3 does not receive any BPDU that
contains the root bridge ID. After the Max Age timer expires, the port enters
the Listening state and starts to forward the BPDU that contains the root
bridge ID from the upstream device to SW2.
 After the Max Age timer expires, SW2 and SW3 receive BPDUs from each
other almost at the same time and perform STP recalculation. SW2 finds that
the BPDU sent by SW3 is superior, so it does not declare itself as the root
bridge and re-determines the port role.
Port state:
 The alternate port of SW3 enters the Listening state from the Blocking state
after 20s and then enters the Learning state. Finally, the port enters the
Forwarding state to forward user traffic.
Convergence time:
 It takes about 50s to recover from an indirect link failure, which is equal to
the value of the Max Age timer plus twice the value of the Forward Delay
timer.
STP Principles and Configuration Page 24

1.4.12 The MAC Address Table Is Incorrect Because the


Topology Changes

Figure 1-1 Case 1


As shown in the figure, the root port of SW3 is faulty, causing the spanning tree
topology to re-converge. After the spanning tree topology re-converges, Host B
cannot receive frames sent by Host A. This is because switches forward data
frames based on the MAC address table. By default, the aging time of MAC
address entries is 300s. How is forwarding restored rapidly?
On a switching network, a switch forwards data frames based on the MAC
address table. By default, the aging time of MAC address entries is 300 seconds.
If the spanning tree topology changes, the forwarding path of the switch also
changes. In this case, the entries that are not aged in a timely manner in the
MAC address table may cause data forwarding errors. Therefore, the switch
needs to update the MAC address entries in a timely manner after the topology
changes.
In this example, the MAC address entry on SW2 defines that packets can reach
Host A through GE0/0/1 and reach Host B through GE0/0/3. The root port of SW3
is faulty, causing the spanning tree topology to re-converge. After the spanning
tree topology re-converges, Host B cannot receive frames sent by Host A. This is
because the aging time of MAC address entries is 300s. After a frame sent from
Host A to Host B reaches SW2, SW2 forwards the frame through GE0/0/3.

Figure 1-2 Case 2


 TCN BPDUs are generated when the network topology changes.
STP Principles and Configuration Page 25

 Packet format: protocol identifier, version number, and type


 Topology change: The TCA and TC bits in the Flags field of configuration
BPDUs are used.
When the network topology changes, the root bridge sends TCN BPDUs to notify
other devices of the topology change. The root bridge generates TCs to instruct
other switches to age existing MAC address entries.
The process of topology change and MAC address entry update is as follows:
1) After SW3 detects the network topology change, it continuously sends TCN
BPDUs to SW2.
2) After SW2 receives the TCN BPDUs from SW3, it sets the TCA bit in the Flags
field of the BPDUs to 1 and sends the BPDUs to SW3, instructing SW3 to stop
sending TCN BPDUs.
3) SW2 forwards the TCN BPDUs to the root bridge.
4) SW1 sets the TC bit in the Flags field of the configuration BPDU to 1 and
sends the configuration BPDU to instruct the downstream device to change
the aging time of MAC address entries from 300s to the value of the Forward
Delay timer (15s by default).
5) The incorrect MAC address entries on SW2 are automatically deleted after
15s at most. Then, SW2 starts to learn MAC address entries again and
forwards packets based on the learned MAC address entries.

1.5 Basic STP Configurations


1.5.1 Basic STP Configuration Commands
Step 1 Configure a working mode.

[Huawei] stp mode { stp | rstp | mstp }

The switch supports three working modes: STP, RSTP, and Multiple Spanning
Tree Protocol (MSTP). By default, a switch works in MSTP mode. On a ring
network running only STP, the working mode of a switch is configured as STP; on
a ring network running RSTP, the working mode of a switch is configured as
RSTP.

Step 2 (Optional) Configure the root bridge.

[Huawei] stp root primary

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.

Step 3 (Optional) Configure the switch as the secondary root bridge.

[Huawei] stp root secondary

Configure the switch as the secondary root bridge. 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.
STP Principles and Configuration Page 26

Step 4 (Optional) Configure the STP priority of a switch.

[Huawei] stp priority priority

By default, the priority value of a switch is 32768.

Step 5 (Optional) Configure a path cost for a port.

[Huawei] stp pathcost-standard { dot1d-1998 | dot1t | legacy }

Configure a path cost calculation method. By default, the IEEE 802.1t standard
(dot1t) is used to calculate path costs.
All switches on a network must use the same path cost calculation method.

[Huawei-GigabitEthernet0/0/1] stp cost cost

Set the path cost of the port.

Step 6 (Optional) Configure a priority for a port.

[Huawei-GigabitEthernet0/0/1] stp priority priority

Configure a priority for a port. By default, the priority of a switch port is 128.

Step 7 Enable STP, RSTP, or MSTP.

[Huawei] stp enable

Enable STP, RSTP, or MSTP on a switch. By default, STP, RSTP, or MSTP is enabled
on a switch.

1.5.2 Case 1: Basic STP Configurations

Figure 1-1 Case 1


 Deploy STP on the three switches to eliminate Layer 2 loops on the network.
 Configure SW1 as the root bridge and block GE0/0/22 on SW3.
SW1 configuration:

[SW1] stp mode stp


[SW1] stp enable
[SW1] stp priority 0

SW2 configuration:
STP Principles and Configuration Page 27

[SW2] stp mode stp


[SW2] stp enable
[SW2] stp priority 4096

SW3 configuration:

[SW3] stp mode stp


[SW3] stp enable

Check brief information about STP states of ports on SW3.

<SW3> display stp brief


MSTID Port Role STP State Protection
0 GigabitEthernet0/0/21 ROOT FORWARDING NONE
0 GigabitEthernet0/0/22 ALTE DISCARDING NONE

1.6 Improvements Made in RSTP


1.6.1 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.
STP does not differentiate between port roles according to their states, making it
difficult for less experienced administrators to learn about and deploy this
protocol.
 Ports in Listening, Learning, and Blocking states are the same for users
because none of these ports forwards service traffic.
 In terms of port use and configuration, the essential differences between
ports lie in the port roles but not port states.
 Both root and designated ports can be in Listening state or Forwarding state,
so the port roles cannot be differentiated according to their 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.

1.6.2 RSTP Overview


RSTP defined in IEEE 802.1w is an enhancement to STP. RSTP optimizes STP in
many aspects, provides faster convergence, and is compatible with STP.
RSTP introduces new port roles. When the root port fails, the switch can enable
the alternate port to obtain an alternate path from the designated bridge to the
root bridge. RSTP defines three states for a port based on whether the port
forwards user traffic and learns MAC addresses. In addition, RSTP introduces the
edge port. The port connecting a switch to a terminal is configured as an edge
port that enters the Forwarding state immediately after initialization, thus
improving the working efficiency.
The IEEE 802.1w standard released in 2001 defines RSTP. RSTP is an
improvement on STP and implements fast network topology convergence.
STP Principles and Configuration Page 28

RSTP is evolved from STP and has the same working mechanism as STP. When
the topology of a switching network changes, RSTP can use the
Proposal/Agreement mechanism to quickly restore network connectivity.
RSTP removes three port states, defines two new port roles, and distinguishes
port attributes based on port states and roles. In addition, RSTP provides
enhanced features and protection measures to ensure network stability and fast
convergence.
RSTP is backward compatible with STP, which is not recommended because STP
slow convergence is exposed.
Improvements made in RSTP:
 RSTP processes configuration BPDUs differently from STP.
 When the topology becomes stable, the mode of sending configuration
BPDUs is optimized.
 RSTP uses a shorter timeout interval of BPDUs.
 RSTP optimizes the method of processing inferior BPDUs.
 RSTP changes the configuration BPDU format and uses the Flags field to
describe port roles.
 RSTP topology change processing: Compared with STP, RSTP is optimized to
accelerate the response to topology changes.

1.6.3 Improvements Made in RSTP


RSTP processes configuration BPDUs differently from STP.
 When the topology becomes stable, the mode of sending configuration
BPDUs is optimized.
 RSTP uses a shorter timeout interval of BPDUs.
 RSTP optimizes the method of processing inferior BPDUs.
RSTP changes the configuration BPDU format and uses the Flags field to describe
port roles.
RSTP topology change processing: Compared with STP, RSTP is optimized to
accelerate the response to topology changes.

1.6.4 Port Roles in RSTP


RSTP adds port roles to help understand RSTP and simplify RSTP deployment.

Figure 1-1 Port Roles in RSTP


RSTP defines four port roles: root port, designated port, alternate port, and
backup port.
From the perspective of configuration BPDU transmission:
STP Principles and Configuration Page 29

 An alternate port is blocked after learning a configuration BPDU sent from


another network bridge.
 A backup port is blocked after learning a configuration BPDU sent from itself.
From the perspective of user traffic:
 An alternate port acts as a backup of the root port and provides an alternate
path from the designated bridge to the root bridge.
 A backup port backs up a designated port and provides a backup path from
the root bridge to the related network segment.

1.6.5 Edge Port


An edge port is located at the edge of a region and does not connect to any
switching device.

Figure 1-1 Edge Port


Generally, an edge port is directly connected to a user terminal. The edge port
can transition from the Disabled state to the Forwarding state.
In STP, it takes 15 seconds for the port of a switch connected to a user terminal
to transition from Disabled to Forwarding. During this period, the user terminal
cannot access the Internet. If the network changes frequently, the Internet
access status of the user terminal is unstable.
An edge port is directly connected to a user terminal and is not connected to any
switching device. An edge port does not receive or process configuration BPDUs
and does not participate in RSTP calculation. It can transition from Disabled to
Forwarding without any delay. An edge port becomes a common STP port once it
receives a configuration BPDU. The spanning tree needs to be recalculated,
which leads to network flapping.

1.6.6 Port States in RSTP


RSTP deletes two port states defined in STP, reducing the number of port states
to three.
 If the port does not forward user traffic or learn MAC addresses, it is in
Discarding state.
 If the port does not forward user traffic but learns MAC addresses, it is in
Learning state.
 If the port forwards user traffic and learns MAC addresses, it is in Forwarding
state.
STP Principles and Configuration Page 30

Table 1-1 Port States in RSTP


STP Port State RSTP Port State Port Role

Root port or designated


Forwarding Forwarding
port

Root port or designated


Learning Learning
port

Root port or designated


Listening Discarding
port

Alternate port or backup


Blocking Discarding
port

Disabled Discarding Disabled port

1.7 STP Advancement


1.7.1 Defects of STP/RSTP: All VLANs Share One Spanning
Tree
RSTP, an enhancement to STP, allows for fast network topology convergence.
STP and RSTP both have a defect: All VLANs on a LAN share one spanning tree.
As a result, inter-VLAN load balancing cannot be performed, and blocked links
cannot transmit any traffic, which may lead to VLAN packet transmission failures.

Figure 1-1 Defects of STP/RSTP

1.7.2 VBST
Huawei provides the VLAN-based Spanning Tree (VBST). VBST constructs a
spanning tree in each VLAN so that traffic from different VLANs is load balanced
along different spanning trees.
STP Principles and Configuration Page 31

Figure 1-1 VBST


VBST brings in the following benefits:
 Eliminates loops.
 Implements link multiplexing and load balancing, and therefore improves link
use efficiency.
 Reduces configuration and maintenance costs.
If a great number of VLANs exist on a network, spanning tree computation for
each VPN consumes a huge number of switch processor resources.

1.7.3 MSTP
To fix the defects, the IEEE released the 802.1s standard that defines the
Multiple Spanning Tree Protocol (MSTP) in 2002.
MSTP is compatible with STP and RSTP, and can rapidly converge traffic and
provides multiple paths to load balance VLAN traffic.

Figure 1-1 MSTP


MSTP Overview
 MSTP divides a switching network into multiple regions, each of which has
multiple spanning trees that are independent of each other.
 Each spanning tree is called a multiple spanning tree instance (MSTI).
 An MSTI is the spanning tree corresponding to a set of VLANs.
 Binding multiple VLANs to a single MSTI reduces communication costs and
resource usage.
 The topology of each MSTI is calculated independently, and traffic can be
balanced among MSTIs.
STP Principles and Configuration Page 32

 Multiple VLANs with the same topology can be mapped to a single MSTI. The
forwarding state of the VLANs for an interface is determined by the interface
state in the MSTI.

1.7.4 Stack and Tree Networking of Campus Networks


Traditional STP Networking
 Two aggregation switches form a triangle Layer 2 loop with access switches,
so STP must be deployed on the network. However, STP blocks ports on the
network, causing a failure to fully utilize link bandwidth.

Figure 1-1 Traditional STP Networking


iStack Networking
 Aggregation switches are stacked to form a single logical device, simplifying
the network topology. In addition, link aggregation is deployed between
aggregation switches and access switches to simplify the network topology
to a tree topology, eliminating Layer 2 loops and improving link bandwidth
utilization.

Figure 1-2 iStack Networking


Intelligent Stack (iStack) enables multiple iStack-capable switches to function as
a logical device.
Before an iStack system is set up, each switch is an independent entity and has
its own IP address and MAC address. You need to manage the switches
separately. After an iStack system is set up, switches in the iStack system form a
logical entity and can be managed and maintained using a single IP address.
iStack technology improves forwarding performance and network reliability, and
simplifies network management.
STP Principles and Configuration Page 33

1.7.5 Smart Link

Figure 1-1 Smart Link


Smart Link is tailored for dual-uplink networking.
 Smart Link is deployed on two switches where a host is dual-homed. When
the network is normal, one of the two uplinks is active, and the other is in
standby state (does not carry service traffic). In this way, a Layer 2 loop is
eliminated.
 When the active link is faulty, traffic is switched to the standby link in
milliseconds. This ensures proper data forwarding.
 Smart Link is easy to configure.
 Smart Link does not involve protocol packet exchange, therefore greatly
improving speed and reliability.
As shown in the figure, SW3 is connected to FW1 and FW2 through dual uplinks.
In this way, Switch3 has two uplinks to the uplink device. Smart Link can be
configured on SW3. In normal situations, the link on Port2 functions as a backup
link. If the link on Port1 fails, Smart Link automatically switches data traffic to the
link on Port2 to ensure service continuity.

1.8 Quiz
1. (Single)Which statement about the STP port state is false? ( )
A. The blocked port does not listen to or send BPDUs.
B. A port in learning state learns MAC addresses but does not forward data.
C. A port in Listening state keeps listening to BPDUs.
D. If a blocked port does not receive BPDUs within a specified period, the port
automatically switches to the Listening state.
2. (Single)What port states does a standard spanning tree have? ( )
A. 3
B. 4
STP Principles and Configuration Page 34

C. 5
D. 6
3. (Single)Which of the following statements about STP are correct? ( )
A. The root bridge does not have a designated port.
B. The root bridge does not have a root port.
C. A non-root bridge may have one root port and multiple designated ports.
D. A non-root bridge may have multiple root ports and a designated port.
4. (Multiple)Which of the following statements about STP are correct? ( )
A. Two different switches cannot have the same priority.
B. The smaller the bridge ID of a switch, the more likely it is to become the
root bridge.
C. The PID value does not affect the election result of the root bridge.
D. The priority of the bridge ID ranges from 0 to 65535.
5. (True or False)In STP, the default Hello Time of BPDUs is set to 1s. ( )
A. True
B. False
6. (True or False)The blocked port on the STP can learn the MAC address of user
traffic but cannot forward user traffic. ( )
A. True
B. False

1.9 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.
After STP is configured on an Ethernet switching network, the protocol calculates
the network topology to implement the following functions:
 Loop prevention: The spanning tree protocol blocks redundant links to
prevent potential loops on the network.
 Link redundancy: If an active link fails and a redundant link exists, the
spanning tree protocol activates the redundant link to ensure network
connectivity.
STP cannot meet requirements of modern campus networks. However,
understanding the working mechanism of STP helps you better understand the
working mechanism and deployment of RSTP and MSTP.

You might also like