Example for configuring STP [All About Switches]

Latest reply: Jul 4, 2018 07:32:14 22406 5 2 0

This post covers an example for configuring STP. Please have a look below.


1. Overview


If a loop occurs on a Layer 2 switching network, the packets will be transmitted infinitely, causing a broadcast storm. All available bandwidth is consumed by the broadcast storm and therefore the valid packets cannot be transmitted on the network.


Spanning Tree Protocol, a Layer 2 management protocol, selectively blocks redundant links to remove any Layer 2 loops on a network. In addition, STP supports link redundancy.

Like other protocols, STP is continuously upgraded with the development of networks. STP refers to the Spanning Tree Protocol (STP) defined in IEEE 802.1D, the Rapid Spanning Tree Protocol (RSTP) defined in IEEE 802.1W, and the Multiple Spanning Tree Protocol (MSTP) defined in IEEE 802.1S.


Comparisons among STP, RSTP, and MSTP:


Spanning Tree Protocol

Characteristics

Usage Scenario

STP

         A loop-free tree topology is formed in an STP region to prevent broadcast storms while implementing link redundancy.

         Route convergence is slow.

All VLANs share one spanning tree, and users or services do not need to be differentiated.

RSTP

         A loop-free tree topology is formed in an STP region to prevent broadcast storms while implementing link redundancy.

         RSTP achieves fast network convergence.

MSTP

         Multiple loop-free tree topologies are formed in an STP region to prevent broadcast storms while implementing link redundancy.

         MSTP achieves fast network convergence.

         MSTP implements load balancing among VLANs. Traffic in different VLANs is transmitted along different paths.

Traffic in different VLANs is forwarded through different spanning trees for load balancing. The spanning trees are independent of each other. In this situation, users or services are distinguished by VLANs.

 

2. Implementation


2.1. Huawei Implementation


? All versions and models of Huawei switches support STP.


? By default, Huawei switches work in MSTP mode. You must manually change the working mode if the STP or RSTP mode is required.


? Huawei switches have the same port roles when working in STP and RSTP modes: designated port, root port, alternate port, backup port, and edge port.


? Huawei switches working in STP mode support BPDU protection, root protection, loop protection, and TC protection.

? Version differences:


l Starting from V100R006, Huawei X7 switches have STP enabled by default.


l In V200R001 and later versions, Huawei switches support automatic detection of edge ports. If a port does not receive BPDUs, the port becomes an edge port (the stp edged-port enable command configuration is not generated automatically).


l In V200R001 and later versions, if the stp edged-port enable command has been configured on a port, the port can be configured with root protection and loop protection. In versions prior to V200R001, the system displays an error message when you configure root protection on such a port.


55e65fa0a0a6a.png


55e65fa0bf77b.png


2.2. Implementation of Other Vendors


? H3C


l  There are nearly no differences between STP commands on H3C switches and Huawei S series switches.


l  H3C switches use its proprietary standard to calculate path costs by default, whereas Huawei S series switches use IEEE 802.1T standard to calculate path costs by default. When an H3C switch connects to a Huawei S series switch, you are advised to specify the same standard to calculate the path costs.


l  On some legacy H3C switches, when STP is disabled globally or STP is enabled globally but disabled on a port, the port forwards received BPDUs as common multicast data packets in a VLAN. On Huawei S series switches, a port discards the BPDUs in such a scenario.


?  Cisco


Cisco switches support the following spanning tree protocols: Per VLAN Spanning Tree (PVST), PVST Plus (PVST+), Rapid PVST+, and Multiple Spanning Tree (MST). Bridge protocol data units (BPDUs) of PVST+, Rapid PVST+, and MST use Cisco proprietary BPDU formats, which are different from the standard BPDU format defined by the Institute of Electrical and Electronics Engineers (IEEE).


l  Whether a Cisco switch running PVST+ or Rapid PVST+ can interwork with a Huawei S series switch depends on the link type of the Cisco switch's port connected to the S series switch.


? If the link type of the port is trunk and the port is removed from VLAN 1, the Cisco switch cannot interwork with the S series switch. The port on the Cisco switch sends Cisco proprietary BPDUs in VLANs other than VLAN 1, whereas the S series switch forwards the Cisco proprietary BPDUs as common multicast data packets. You can run the l2protocol-tunnel command to configure the S series switch to transparently transmit the Cisco proprietary BPDUs. When a fixed switch is configured to transparently transmits Cisco PVST+ BPDUs using the l2protocol-tunnel command, run the bpdu mac-address 0100-0ccc-cccd command in the system view on the switch.


? If the link type of the port is trunk and the port has been added to VLAN 1, the Cisco switch can interwork with the S series switch in VLAN 1 only.


? If the link type of the port is access, the Cisco switch can interwork with the S series switch.


l  Cisco MST can be considered as a standard MSTP protocol, so a Cisco switch running MST can interwork with an S series switch. When an S series switch running MSTP and a Cisco switch running MST use the same region configuration (region name, revision level, and mapping VLANs and instances), enable the digest snooping function on the connected port of the Huawei switch to implement interworking in an MSTP region. Huawei and Cisco switches use different keys to generate MSTP digests in BPDUs, so the digests in BPDUs are different. MSTP and Cisco MST can implement only inter-region interoperation because Huawei and Cisco switches generate different digests.

In the following descriptions, STP refers to the Spanning Tree Protocol defined in IEEE 802.1D-1998.


3. STP Principles


3.1. Negotiation


STP election and negotiation are performed based on four vectors. STP devices send BPDUs and compare the four vectors in BPDUs to block the port with the lowest capability.

Vectors for STP election (bridge ID, root path cost, sender PID, and PID).


Dimension

Definition

Function

Bridge ID (BID)

A BID is composed of a 16-bit bridge priority (leftmost 16 bits) and a bridge MAC address (rightmost 48 bits).

It is used to determine the root bridge. The device with the smallest BID is elected as the root bridge.

Root path cost

The accumulated cost of the path from a port to the root bridge is the sum of path costs of all ports on the bridges along the path.

It is used for electing the root port, designated port, and blocked port.

Sender BID

It is the BID in outgoing BPDUs.

It is used for electing the root port, designated port, and blocked port.

PID

It is the port ID (PID) in outgoing BPDUs.

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

It is used only when there is a backup port.

 

3.2. Roles and States


STP devices compare four factors to negotiate the port roles and states, so as to determine the traffic forwarding path. The following figure shows STP roles.


55e65fa0dfbe4.png


?  Root bridge: is the bridge with the smallest BID. A BID is composed of a 16-bit bridge priority (leftmost 16 bits) and a bridge MAC address (rightmost 48 bits). On Huawei switches, the default bridge priority is 32768. When the bridge priority is not changed, the device with the smallest MAC address is the root bridge.


?  Designed port: is responsible for forwarding BPDUs. All the ports on the root bridge are designated ports. A designated port can forward traffic normally.


55e65fa10f556.png


?  Root port: is the port with the smallest path cost to the root bridge. The root port can forward traffic normally.


55e65fa12da99.png


?  Blocked port: is a port that is not allowed to forward traffic.


55e65fa14ffd1.png


After STP negotiation is complete, a port is either blocked or forwards packets normally. There are some intermediate states of ports during STP negotiation.


Port State

Purpose

Description

Forwarding

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

Only the root port and designated port can enter the Forwarding state.

Learning

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.

This is a transitional state, which is designed to prevent temporary loops.

Listening

All ports are in Listening state before the root bridge, root port, and designated port are selected.

This is a transitional state.

Blocking

A port in Blocking state receives and forwards only BPDUs, and does not forward user traffic.

This is the final state of a blocked port.

3.3. BPDU Format


STP uses BPDUs with destination multicast MAC address 01-80-C2-00-00-00, encapsulated in IEEE 802.3 format.


55e65fa17560e.png


3.4. BPDU Processing


3.4.1. BPDU Classification


?  Configuration BPDU: There are three types of configuration BPDUs depending on the Flags field:


Type 1: The values of TCA and TC bits are both 0.


Type 2: The values of TCA and TC bits are both 1.


Type 3: The value of the TCA bit is 0 and the value of the TC bit is 1.


?  TCN BPDU: The value of the BPDU Type field is 0x80.


3.4.2. BPDU Processing Flowchart


55e65fa1ce186.png

 

3.4.3. BPDU Foramt


?  Configuration BPDU: The value of the BPDU Type field is 0x00.


1.         Type 1: The values of TCA and TC bits are both 0.


The configuration BPDU is used for negotiating and maintaining the STP status.


55e65fa21324f.png


2.         Type 2: The values of TCA and TC bits are both 1.


The configuration BPDU is used to notify the downstream device of stopping sending TCN BPDUs.


55e65fa25b5a4.png


3.         Type 3: The value of the TCA bit is 0 and the value of the TC bit is 1.


The configuration BPDU is used to notify the downstream device of deleting its MAC address entry.


55e65fa2a2d49.png


?  TCN BPDU: The value of the BPDU Type field is 0x80. The TCN BPDU is used to notify the upstream device of the network topology change.


55e65fa308660.png


4. Configuration Notes


?  On fixed switches, ports send STP BPDUs to the CPU after the bpdu enable command is configured globally or on ports. Without this configuration, the ports cannot send BPDUs to the CPU after receiving the BPDUs. STP then cannot converge.


For S2700 switches in V100R005 and earlier versions, check whether the bpdu enable command has been configured globally. For other fixed switches in V100R006 and earlier versions, check whether the bpdu enable command has been configured on physical ports and the Eth-Trunk.


For fixed switches in V100R006 and later versions, the bpdu enable command is configured globally or on ports by default on corresponding models.


?  After STP is enabled on an Eth-Trunk, change the cost of the Eth-Trunk to a value smaller than the cost of physical ports so that the Eth-Trunk will be not negotiated as the backup port. The cost of the Eth-Trunk is the cost of a member port divided by the number of member ports. Therefore, the Eth-Trunk cost changes after the status of member ports changes. A smaller cost indicates better link quality.

?  The display stp brief command displays only information about all STP-enabled ports in Up state.


?  You can select the port to be blocked by changing the path cost and sender's BID.


5. Configuration Example


5.1. Networking Requirements


55e65fa33c667.png


As shown in the figure, SwitchA, SwitchB, SwitchC, and SwitchD constitute a ring network to provide link redundancy. A spanning tree protocol is required to block a port and prune the network into a loop-free tree network.

?  When the active link fails, service traffic needs to be switched to the backup link. The customer requires simple configuration but has no high requirement for the switching time.

?  SwitchA with higher performance needs to act as the root bridge, and SwitchB is used as the secondary root bridge.


?  SwitchC and SwitchD connect to users, and the link between SwitchC and SwitchD needs to be blocked.


?  On SwitchC and SwitchD, GE0/0/3 ports connected to users cannot participate in STP calculation.


5.2. Configuration Roadmap


The configuration roadmap is as follows:


1. Configure switches to work in STP mode.


2. Configure SwitchA as the root bridge and SwitchB as the secondary root bridge.


3. Configure switches to use the default path cost. Huawei switches use IEEE 802.1T standard to calculate path costs by default. By default, the cost of a GE port is 20000, and the cost of an Ethernet port is 200000. In eNSP, the default STP path cost is 1.


4. Disable STP on GE0/0/3 ports on SwitchC and SwitchD.


5. Enable STP on SwitchA, SwitchB, SwitchC, and SwitchD.


5.3. Procedure


Step 1: Configure switches to work in STP mode.


<HUAWEI> system-view

[HUAWEI] sysname SwitchA

[SwitchA] stp mode stp

 

<HUAWEI> system-view

[HUAWEI] sysname SwitchB

[SwitchB] stp mode stp

 

<HUAWEI> system-view

[HUAWEI] sysname SwitchC

[SwitchC] stp mode stp

 

<HUAWEI> system-view

[HUAWEI] sysname SwitchD

[SwitchD] stp mode stp

 

Step 2: Configure SwitchA as the root bridge and SwitchB as the secondary root bridge.


[SwitchA] stp root primary   //You can also use the stp priority 0 command to set the STP priority to 0. Running the stp priority 0 command is equivalent to running the stp root primary command.

 

[SwitchB] stp root secondary  //You can also use the stp priority 4096 command to set the STP priority to 4096. The stp priority 4096 command is equivalent to the stp root secondary command.

 

Step 3: Disable STP on GE0/0/3 interfaces of SwitchC and SwitchD.


[SwitchC] interface gigabitethernet0/0/3

[SwitchC-GigabitEthernet0/0/3] stp disable

[SwitchC-GigabitEthernet0/0/3] quit

 

[SwitchD] interface gigabitethernet0/0/3

[SwitchD-GigabitEthernet0/0/3] stp disable

[SwitchD-GigabitEthernet0/0/3] quit

 

Step 4: Enable STP globally.


On Huawei X7 series switches, STP is enabled by default, so you can skip this step.

[SwitchA] stp enable

 

[SwitchB] stp enable

 

[SwitchC] stp enable

 

[SwitchD] stp enable

 

Step 5: Verify the configuration.


Check brief information about STP. You can view the port roles and states.


55e65fa3615ed.png


5.4. Configuration Files


Configuration file of SwitchA


#

sysname SwitchA

#

stp mode stp

stp instance 0 root primary

#

return

Configuration file of SwitchB


#

sysname SwitchB

#

stp mode stp

stp instance 0 root secondary

# 

return 

Configuration file of SwitchC


#

sysname SwitchC 

# 

stp mode stp

# 

interface GigabitEthernet0/0/3

 stp disable

# 

return 

Configuration file of SwitchD


#

sysname SwitchD

# 

stp mode stp

# 

interface GigabitEthernet0/0/3

 stp disable

# 

return

 

★★★Summary★★★ All About Huawei Switch Features and Configurations


This article contains more resources

You need to log in to download or view. No account?Register

x
  • x
  • convention:

e84035533
Created Sep 28, 2015 08:16:47 Helpful(1) Helpful(1)

Thanks to much to Docs team,

Even understanding technology and how device works flow chart is so usefull. Also when try to troubleshoot it is so useful.

Like a logical diagram, like a algorithm i follow these steps.

Thanks for your good works

  • x
  • convention:

user_2790689
Created Jun 25, 2015 10:27:17 Helpful(1) Helpful(1)

Thank you.
  • x
  • convention:

j00359811
Created Mar 1, 2016 12:03:04 Helpful(1) Helpful(1)

thanks for this infor. really helped me.

  • x
  • convention:

user_3105635
Created Jul 4, 2018 07:14:52 Helpful(0) Helpful(0)

MSTID Port Role STP State Protection
0 GigabitEthernet0/0/9 DESI FORWARDING NONE
0 GigabitEthernet0/0/10 DESI FORWARDING NONE
Ring switch is going root bridge
  • x
  • convention:

user_3105635
Created Jul 4, 2018 07:32:14 Helpful(0) Helpful(0)

Posted by user_3105635 at 2018-07-04 07:14 MSTID Port Role STP State Protection 0 GigabitEthernet0/0/9 ...
please suggest
  • x
  • convention:

Comment

Reply
You need to log in to reply to the post Login | Register

Notice Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " Privacy."
If the attachment button is not available, update the Adobe Flash Player to the latest version!
Login and enjoy all the member benefits

Login and enjoy all the member benefits

Login