Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document.
Note: Even the most advanced machine translation cannot match the quality of professional translators.
Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).

Basic Concepts of STP/RSTP

Basic Concepts of STP/RSTP

Root Bridge

A tree topology must have a root. As defined in STP, the device
that functions as the root of a tree network is called the root bridge.

There is only one root bridge on the entire STP network. Although
the root bridge is not necessarily at the physical center of the network,
it functions as its logical center. The root bridge changes dynamically
with the network topology.

After network convergence, the root
bridge generates and sends configuration BPDUs at a specific interval.
Upon receipt of the configuration BPDUs, non-root bridges compare
whether the priority of the received BPDUs is higher than that of
their local configuration BPDUs. If the priority is higher, the non-root
bridges update their configuration BPDU information stored on their
STP interfaces based on the information in the received BPDUs. If
the priority is lower, the non-root bridges discard the received configuration
BPDUs.

Metrics for Spanning Tree
Calculation

A spanning tree is calculated based on the following
metrics: bridge ID (BID), port ID (PID), and path cost. The following
describes the metrics:

BID

According to IEEE 802.1D, a BID is composed
of a bridge priority (leftmost 16 bits) and a bridge MAC address (rightmost
48 bits).

On an STP network, the device with the smallest BID
is elected as the root bridge.

PID

A PID is composed of a port priority (leftmost
4 bits) and a port number (rightmost 12 bits).

The PID is used
to select the designated port.

NOTE:

The port priority
affects the role of a port in a specified spanning tree instance.
For details, see STP Topology Calculation.

Path cost

The path cost is a port variable
used for link selection. STP calculates path costs to select robust
links, block redundant links, and finally trim the network into a
loop-free tree topology.

On an STP network, a port's path cost
to the root bridge is the sum of the path costs of all ports between
the port and the root bridge. This path cost is the root path cost.

Root Bridge, Root Port,
and Designated Port

Three elements are involved in pruning
a ring network into a tree network: root bridge, root port, and designated
port. Figure 14-2 shows the three elements in the STP network architecture.

Figure 14-2 STP network architecture

Root bridge

The root bridge is the bridge
with the smallest BID, which is discovered by exchanging configuration
BPDUs.

Root port

The root port on an STP device is
the port with the smallest path cost to the root bridge and is responsible
for forwarding data to the root bridge. An STP device has only one
root port, and there is no root port on the root bridge.

A directly connected device that forwards configuration
BPDUs to the device

The designated bridge's port that forwards configuration
BPDUs to the device

LAN

A device that forwards configuration BPDUs to the LAN

The designated bridge's port that forwards configuration
BPDUs to the LAN

In Figure 14-3, AP1 and AP2 are
ports of S1; BP1 and BP2 are ports of S2; CP1 and CP2 are ports of
S3.

S1 sends configuration BPDUs to S2 through AP1, so S1 is the
designated bridge for S2, and AP1 is the designated port on S1.

S2 and S3 are connected to the LAN. If S2 forwards configuration
BPDUs to the LAN, S2 is the designated bridge for the LAN, and BP2
is the designated port on S2.

Figure 14-3 Designated bridge and designated port

After the root bridge, root ports, and designated ports are
selected successfully, a tree topology is set up on the entire network.
When the topology is stable, only the root port and designated ports
forward traffic. The other ports are in Blocking state; they only
receive STP BPDUs and do not forward user traffic.

Path cost to the root bridge. It is determined by the distance
between the port sending the configuration BPDU and the root bridge.

Sender BID

BID of the device that sends the configuration BPDU.

PID

PID of the port that sends the configuration BPDU.

After a device on the STP network receives a configuration
BPDU, it compares the fields listed in Table 14-2 with its own values.
The four comparison principles are as follows:

Smallest BID: used to select the root bridge. Devices on an STP
network select the device with the smallest BID to become the root
bridge. This BID is then used as the root ID field in Table 14-2.

Smallest root path cost: used to select the root port on a non-root
bridge. The port with the smallest root path cost is selected as the
root port. On the root bridge, the path cost of each port is 0 and
there is no root port.

Smallest sender BID: used to select the root port among ports
with the same root path cost. The port with the smallest sender BID
is selected as the root port in STP calculation. For example, S2 has
a smaller BID than S3 in Figure 14-2. If the BPDUs
received on port A and port B of S4 contain the same root path cost,
port B becomes the root port on S4 because the BPDU received on port
B has a smaller sender BID.

Smallest PID: used to determine which port should be blocked when
multiple ports have the same root path cost. The port with the smallest
PID is not blocked. The PIDs are compared in the scenario shown in Figure 14-4.
The BPDUs received on port A and port B of S1 contain the same root
path cost and sender BID. Port A has a smaller PID than port B. Therefore,
port B is blocked to prevent loops.

A port in Forwarding state can forward user traffic and
process BPDUs.

Learning

This is a transitional state. When a port is in Learning
state, the device creates MAC address entries based on user traffic
received on the port but does not forward user traffic through the
port.

A port in Learning state receives and processes BPDUs.

Discarding

A port in Discarding state can only receive BPDUs.

After a Huawei device transitions from the Multiple Spanning
Tree Protocol (MSTP) mode (default mode) to the STP mode, its STP
ports support only those states defined in MSTP, which are Forwarding,
Learning, and Discarding. The Forwarding and Learning states are the
same as the corresponding STP states. A port in Discarding state can
only receive BPDUs.

The following parameters affect the STP
port states and convergence speed.

Hello Time

The Hello Time specifies
the interval at which an STP device sends configuration BPDUs to detect
link failures.

When the Hello Time is changed, the new value
takes effect only after a new root bridge is elected. The new root
bridge adds the new Hello Time value in BPDUs it sends to non-root
bridges. When the network topology changes, Topology Change Notification
(TCN) BPDUs are transmitted immediately, irrespective of the Hello
Time.

Forward Delay

The Forward Delay
timer specifies the length of delay before a port state transition.
When a link fails, STP calculation is triggered and the spanning tree
structure changes. However, because new configuration BPDUs cannot
be immediately spread over the entire network, convergence takes some
time. If the new root port and designated port forward data before
convergence, transient loops may occur. Therefore, STP defines a port
state transition delay mechanism. The newly selected root port and
designated port must wait for two Forward Delay intervals before transitioning
to the Forwarding state. During this time, the new configuration BPDUs
can be transmitted over the network, preventing transient loops during
convergence.

The default Forward Delay timer value is 15 seconds.
This means that the port stays in Listening state for 15 seconds and
then stays in Learning state for another 15 seconds before transitioning
to the Forwarding state. The port is blocked when it is in Listening
or Learning state, which is key to preventing transient loops.

Max Age

The Max Age specifies the aging
time of BPDUs. This parameter is configurable on the root bridge.

The Max Age is spread to the entire network with configuration
BPDUs. After a non-root bridge receives a configuration BPDU, it either
forwards or discards the configuration BPDU by comparing the Message
Age value with the Max Age value. The details are as follows:

If the Message Age value is less than or equal to the Max Age
value, the non-root bridge forwards the configuration BPDU.

If the Message Age value is larger than the Max Age value, the
non-root bridge discards the configuration BPDU. When this happens,
the network size is considered too large and the non-root bridge disconnects
from the root bridge.

If the configuration BPDU is sent from the root bridge,
the value of Message Age is 0. Otherwise, the value of Message Age
is the total time spent to transmit the BPDU from the root bridge
to the local bridge, including the transmission delay. In real-world
situations, the Message Age value of a configuration BPDU increases
by 1 each time the configuration BPDU passes through a bridge.