Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

What Is STP?

Issue 01
Date 2020-11-18

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://www.huawei.com
Email: support@huawei.com

Issue 01 (2020-11-18) Copyright © Huawei Technologies Co., Ltd. i


What Is STP? Contents

Contents

1 Introduction.............................................................................................................................. 1
2 Understanding STP.................................................................................................................. 2
3 Configuring STP....................................................................................................................... 5
3.1 Configuring Basic STP............................................................................................................................................................ 5
3.2 Other STP Configurations..................................................................................................................................................... 6
3.3 Example for Configuring Basic STP Functions............................................................................................................... 6

4 Related Information................................................................................................................9

Issue 01 (2020-11-18) Copyright © Huawei Technologies Co., Ltd. ii


What Is STP? 1 Introduction

1 Introduction

To prevent loops from causing broadcast storms and making the MAC address
table unstable, the Spanning Tree Protocol (STP) runs switches when redundant
links are used on the network.
STP is a basic feature of datacom products including switches, routers, and WLAN
products. This chapter describes STP configurations on Huawei CloudEngine series
switches.

Issue 01 (2020-11-18) Copyright © Huawei Technologies Co., Ltd. 1


What Is STP? 2 Understanding STP

2 Understanding STP

STP, defined by IEEE 802.1D, prevents loops on a local area network (LAN).
Switching devices running STP exchange information with one another to discover
loops on the network, and then block certain redundant links to eliminate loops. If
an active link fails, STP activates a running standby link with the highest priority
to ensure network connectivity.
As the scale of LANs continues to grow, STP has become an increasingly important
LAN protocol.

Root Bridge, Root Port, and Designated Port


Three elements are involved in trimming a ring network into a tree network: root
bridge, root port, and designated port.
● Root bridge: There is only one root bridge on the entire STP network. The root
bridge is the logical center, but not necessarily the physical center, of the
network. Typically, the root bridge should have high performance and be
located at a higher layer of the network. When the network topology
changes, the root bridge will be re-elected accordingly. It is recommended
that you manually configure the root bridge and secondary root bridge.
Configure an optimal core switch as the root bridge to ensure stability of the
STP Layer 2 network. Otherwise, new access devices may trigger STP root
bridge switching, causing short service interruptions.
● Root port: The root port on an STP device has the smallest path cost to the
root bridge and is responsible for forwarding data to the root bridge. Among
all STP-capable ports on a device, the port with the smallest root path cost is
a root port. An STP device has only one root port, and there is no root port on
the root bridge.
● Designated port: The designated port is located on a designated bridge and
forwards configuration BPDUs to the device or LAN, as illustrated in Figure 1.
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.

Issue 01 (2020-11-18) Copyright © Huawei Technologies Co., Ltd. 2


What Is STP? 2 Understanding STP

Figure 2-1 Designated bridge and designated port

In addition, a switching device has a bridge ID (BID) and a port on the switching
device has a port ID (PID). A PID is composed of a port priority and a port number.
A BID is composed of a bridge priority and a bridge MAC address. On an STP
network, the device with the smallest BID acts as the root bridge.

After the root bridge, root port, 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.

BPDU Format
A BPDU carries the BID, root path cost, and PID. A BPDU is encapsulated in an
Ethernet frame. Its destination MAC address is a multicast MAC address, 01-80-
C2-00-00-00. The Length or Type field specifies the MAC data length, and is
followed by the LLC header and BPDU header. Figure 2 shows the format of an
Ethernet frame.

Figure 2-2 Format of an Ethernet frame

Each bridge actively 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 configuration BPDU is at least 35
bytes long and includes the parameters such as the BID, root path cost, and PID. A
bridge processes a received configuration BPDU only if either the sender BID or
PID is different from that on the local bridge receive port. If both fields are the
same as those on the receive port, the bridge discards the configuration BPDU.
Therefore, the bridge does not need to process BPDUs with the same information
as the local port.

Issue 01 (2020-11-18) Copyright © Huawei Technologies Co., Ltd. 3


What Is STP? 2 Understanding STP

STP Implementation
STP implementation is as follows:
1. During network initialization, every device considers itself the root bridge and
sets the root ID to its own BID. Then devices exchange configuration BPDUs
and compare their root IDs to find the device with the smallest BID, which
becomes the root bridge. All the ports on the root bridge are in Forwarding
state.
2. A non-bridge device selects the port that receives the optimal configuration
BPDU as the root port. The root port is in the Forwarding state.
3. The device generates a configuration BPDU for each port based on the
configuration BPDU on the root port and path cost of the root port. Then the
device compares the calculated configuration BPDU with the configuration
BPDU received on the port.
– If the calculated configuration BPDU is superior, the port is selected as
the designated port and periodically sends the calculated configuration
BPDU.
– If the port's own configuration BPDU is superior, the configuration BPDU
on the port is not updated and the port is blocked. Then, the port only
receives BPDUs, and does not forward data or send BPDUs.

Issue 01 (2020-11-18) Copyright © Huawei Technologies Co., Ltd. 4


What Is STP? 3 Configuring STP

3 Configuring STP

NOTE

For details about the configuration and commands in this section, see "Ethernet Switching
Configuration Guide" in the CloudEngine 8800, 7800, 6800, and 5800 Series Switches
V200R005C10 Product Documentation.

3.1 Configuring Basic STP


3.2 Other STP Configurations
3.3 Example for Configuring Basic STP Functions

3.1 Configuring Basic STP


Step 1 Run the system-view command to enter the system view.
Step 2 Run the stp mode stp command to set the working mode of the device to STP.
By default, the working mode of a device is MSTP. MSTP is compatible with STP
and RSTP.
Step 3 (Optional) Configure the root bridge and secondary root bridge.
● Run the stp root primary command on a device to configure the device as
the root bridge.
● Run the stp root secondary command on another device to configure the
device as the secondary root bridge.
Step 4 (Optional) Run the stp priority priority command to set a priority for the device.
The default priority value of a device is 32768. The value is an integer multiple of
4096, such as 0, 4096 and 8192. A smaller value indicates a higher priority of the
device. A device with a higher priority is more likely to be elected as the root
bridge. Low-performance devices at lower network layers are not suitable for root
bridges, so you need to set low priorities for these devices.
Step 5 (Optional) Run the stp pathcost-standard { dot1d-1998 | dot1t | legacy }
command to specify a path cost calculation method.
By default, the IEEE 802.1t standard (dot1t) is used to calculate the path cost. All
devices on a network must use the same path cost calculation method.

Issue 01 (2020-11-18) Copyright © Huawei Technologies Co., Ltd. 5


What Is STP? 3 Configuring STP

Step 6 (Optional) Configure a path cost and a priority for a port.


1. Run the interface interface-type interface-number command to enter the
view of an interface participating in STP calculation.
2. Run the stp cost cost command to set a path cost for the port.
If a network has loops, it is recommended that you set a large path cost for
ports with low link rates so that STP blocks these ports.
3. Run the stp port priority priority command to set a priority for the port.
The default priority value of a port on a device is 128.
To block a port on a device, set a greater priority value than the default
priority value for the port.
4. Run the quit command to return to the system view.
Step 7 Run the stp enable command to enable STP on a device.
Step 8 Run the commit command to submit configurations.

----End

3.2 Other STP Configurations


For details about other STP and RSTP configurations, such as the network
diameter, timeout interval, timer, and edge port, see "STP/RSTP Configuration" in
the CloudEngine 8800, 7800, 6800, and 5800 Series Switches V200R005C10
Product Documentation.

3.3 Example for Configuring Basic STP Functions


This section uses the following networking as an example to describe how to
configure basic STP functions and verify the configuration result.

Issue 01 (2020-11-18) Copyright © Huawei Technologies Co., Ltd. 6


What Is STP? 3 Configuring STP

Figure 3-1 Networking diagram of basic STP configurations

1. Configure the STP mode on SwitchA and configure SwitchA as the root bridge.
In addition, set the path cost calculation method to the Huawei proprietary
method.
<SwitchA> system-view
[~SwitchA] stp mode stp
[*SwitchA] stp root primary
[*SwitchA] stp pathcost-standard legacy
[*SwitchA] commit

2. Configure the STP mode on SwitchB and configure SwitchB as the secondary
root bridge. In addition, set the path cost calculation method to the Huawei
proprietary method and disable STP on the port connecting to Server2.
<SwitchB> system-view
[~SwitchB] stp mode stp
[*SwitchB] stp root secondary
[*SwitchB] stp pathcost-standard legacy
[*SwitchB] interface 10ge 1/0/2
[*SwitchB-10GE1/0/2] stp disable
[*SwitchB-10GE1/0/2] commit

3. Configure the STP mode on SwitchC and set the path cost calculation method
to the Huawei proprietary method. In addition, set the path cost of 10GE1/0/1
to 20000, and disable STP on the port connecting to Server1.
<SwitchC> system-view
[~SwitchC] stp mode stp
[*SwitchC] stp pathcost-standard legacy
[*SwitchC] interface 10ge 1/0/1
[*SwitchC-10GE1/0/1] stp cost 20000
[*SwitchC-10GE1/0/1] quit
[*SwitchC] interface 10ge 1/0/2
[*SwitchC-10GE1/0/2] stp disable
[*SwitchC-10GE1/0/2] commit

Issue 01 (2020-11-18) Copyright © Huawei Technologies Co., Ltd. 7


What Is STP? 3 Configuring STP

4. Configure the STP mode on SwitchD and set the path cost calculation method
to the Huawei proprietary method.
<SwitchD> system-view
[~SwitchD] stp mode stp
[*SwitchD] stp pathcost-standard legacy
[*SwitchD] commit

5. Enable STP on all devices on the ring network. The following configuration
uses SwitchA as an example. Perform the same operations on SwitchB,
SwitchC, and SwitchD.
[~SwitchA] stp enable
[*SwitchA] commit

6. Verify the configuration. After the network becomes stable, run the display
stp brief command on SwitchA to check configurations such as the port role
and status. SwitchA is used as an example.
[~SwitchA] display stp brief
MSTID Port Role STP State Protection Cost Edged
0 10GE1/0/1 DESI forwarding none 2 disable
0 10GE1/0/2 DESI forwarding none 2 disable

Issue 01 (2020-11-18) Copyright © Huawei Technologies Co., Ltd. 8


What Is STP? 4 Related Information

4 Related Information

S12700 V200R013C00 Configuration Guide - Ethernet Switching Configuration


Guide
AR100, AR120, AR150, AR160, AR200, AR1200, AR2200, AR3200, AR3600
V200R010 Configuration Guide - Ethernet Switching Configuration Guide
Wireless Access Controller (AC and FITAP) V200R010C00 Product
Documentation - STP/RSTP Configuration

Issue 01 (2020-11-18) Copyright © Huawei Technologies Co., Ltd. 9

You might also like