Got it

Example for Configuring Basic STP Functions

Latest reply: Mar 31, 2019 10:55:53 360 1 1 0 0

This example shows how to configure basic STP functions.

Networking Requirements

On a complex network, loops are inevitable. With the requirement for network redundancy backup, network designers tend to deploy multiple physical links between two devices, one of which is the master and the others are the backup. Loops are likely or bound to occur in such a situation.

Loops will cause broadcast storms, thereby exhausting network resources and paralyzing the network. Loops also cause flapping of MAC address tables and thus damages MAC address entries.

STP can be deployed on a network to eliminate loops by blocking some ports. On the network shown in Figure 13-6, after Device A, Device B, Device C, and Device D running STP discover loops on the network by exchanging information with each other, they trim the ring topology into a loop-free tree topology by blocking a certain port. In this manner, replication and circular propagation of packets are prevented on the network and the switching devices are released from processing duplicated packets, thereby improving their processing performance.

Figure 13-6 Networking diagram of configuring basic STP functions
imgDownload?uuid=41126ef73ee246669c8eb3a NOTE:

Interfaces 1 through 3 in this example are GE 0/1/1, GE 0/1/2, GE 0/1/3, respectively.


Configuration Roadmap

The configuration roadmap is as follows:
  1. Configure basic STP functions, including:
    1. Configure the STP mode for the ring network.

    2. Configure primary and secondary root bridges.

    3. Set path costs for ports to block certain ports.

    4. Enable STP to eliminate loops, including:
      • Enable STP globally.

      • Enable STP on all the interfaces except the interfaces connected to terminals.

      imgDownload?uuid=41126ef73ee246669c8eb3a NOTE:

      STP is not required on the interfaces connected to terminals because these interfaces do not need to participate in STP calculation.

Data Preparation

To complete the configuration, you need the following data.
  • GE interface number, as shown in Figure 13-6

  • Primary root bridge Device A and secondary root bridge Device D

  • Path cost of a port to be blocked (20000 is used in this example)


  1. Configure basic STP functions.

    1. Configure the STP mode for the devices on the ring network.

      # Configure the STP mode on Device A.

      <HUAWEI> system-view[~HUAWEI] sysname DeviceA[*HUAWEI] stp mode stp[*HUAWEI] commit

      # Configure the STP mode on Device B.

      <HUAWEI> system-view[~HUAWEI] sysname DeviceB[*HUAWEI] stp mode stp[*HUAWEI] commit

      # Configure the STP mode on Device C.

      <HUAWEI> system-view[~HUAWEI] sysname DeviceC[*HUAWEI] stp mode stp[*HUAWEI] commit

      # Configure the STP mode on Device D.

      <HUAWEI> system-view[~HUAWEI] sysname DeviceD[*HUAWEI] stp mode stp[*HUAWEI] commit
    2. Configure primary and secondary root bridges.

      # Configure Device A as a primary root bridge.

      [~DeviceA] stp root primary[*DeviceA] commit

      # Configure Device D as a secondary root bridge.

      [~DeviceD] stp root secondary[*DeviceD] commit
    3. Set path costs for ports in each spanning tree to block certain ports.

      imgDownload?uuid=41126ef73ee246669c8eb3a NOTE:
      • The values of path costs depend on path cost calculation methods. Use the Huawei proprietary calculation method as an example to set the path costs of the ports to be blocked to 20000.

      • All switching devices on a network must use the same path cost calculation method.

      # On Device A, configure the path cost calculation method as the Huawei proprietary method.

      [~DeviceA] stp pathcost-standard legacy[*DeviceA] commit

      # On Device B, configure the path cost calculation method as the Huawei proprietary method.

      [~DeviceB] stp pathcost-standard legacy[*DeviceB] commit

      # On Device C, configure the path cost calculation method as the Huawei proprietary method and set the path cost of GE 0/1/1 to 20000.

      [~DeviceC] stp pathcost-standard legacy[*DeviceC] interface gigabitethernet 0/1/1[*DeviceC-GigabitEthernet0/1/1] stp cost 20000[*DeviceC-GigabitEthernet0/1/1] commit[~DeviceC-GigabitEthernet0/1/1] quit

      # On Device D, configure the path cost calculation method as the Huawei proprietary method.

      [~DeviceD] stp pathcost-standard legacy[*DeviceD] commit
    4. Enable STP to eliminate loops.

      • Disable STP on interfaces connected to PCs.

        # Disable STP on GE 0/1/2 on Device B.

        [~DeviceB] interface gigabitethernet 0/1/2[~DeviceB-GigabitEthernet0/1/2] stp disable[*DeviceB-GigabitEthernet0/1/2] commit[~DeviceB-GigabitEthernet0/1/2] quit

        # Disable STP on GE 0/1/2 on Device C.

        [~DeviceC] interface gigabitethernet 0/1/2[~DeviceC-GigabitEthernet0/1/2] stp disable[*DeviceC-GigabitEthernet0/1/2] commit[~DeviceC-GigabitEthernet0/1/2] quit
      • Enable STP globally.

        # Enable STP globally on Device A.

        [~DeviceA] stp enable[*DeviceA] commit

        # Enable STP globally on Device B.

        [~DeviceB] stp enable[*DeviceB] commit

        # Enable STP globally on Device C.

        [~DeviceC] stp enable[*DeviceC] commit

        # Enable STP globally on Device D.

        [~DeviceD] stp enable[*DeviceD] commit
      • Enable STP on all the interfaces except the interfaces connected to terminals.

        # Enable STP on GE 0/1/1 and GE 0/1/2 on Device A.

        [~DeviceA] interface gigabitethernet 0/1/1[~DeviceA-GigabitEthernet0/1/1] undo shutdown[*DeviceA-GigabitEthernet0/1/1] portswitch[*DeviceA-GigabitEthernet0/1/1] stp enable[*DeviceA-GigabitEthernet0/1/1] quit[*DeviceA] interface gigabitethernet 0/1/2[*DeviceA-GigabitEthernet0/1/2] undo shutdown[*DeviceA-GigabitEthernet0/1/2] portswitch[*DeviceA-GigabitEthernet0/1/2] stp enable[*DeviceA-GigabitEthernet0/1/2] commit[~DeviceA-GigabitEthernet0/1/2] quit

        # Enable STP on GE 0/1/1 and GE 0/1/3 on Device B.

        [~DeviceB] interface gigabitethernet 0/1/1[~DeviceB-GigabitEthernet0/1/1] undo shutdown[*DeviceB-GigabitEthernet0/1/1] portswitch[*DeviceB-GigabitEthernet0/1/1] stp enable[*DeviceB-GigabitEthernet0/1/1] quit[*DeviceB] interface gigabitethernet 0/1/3[*DeviceB-GigabitEthernet0/1/3] undo shutdown[*DeviceB-GigabitEthernet0/1/3] portswitch[*DeviceB-GigabitEthernet0/1/3] stp enable[*DeviceB-GigabitEthernet0/1/3] commit[~DeviceB-GigabitEthernet0/1/3] quit

        # Enable STP on GE 0/1/1 and GE 0/1/3 on Device C.

        [~DeviceC] interface gigabitethernet 0/1/1[~DeviceC-GigabitEthernet0/1/1] undo shutdown[*DeviceC-GigabitEthernet0/1/1] portswitch[*DeviceC-GigabitEthernet0/1/1] stp enable[*DeviceC-GigabitEthernet0/1/1] quit[*DeviceC] interface gigabitethernet 0/1/3[*DeviceC-GigabitEthernet0/1/3] undo shutdown[*DeviceC-GigabitEthernet0/1/3] portswitch[*DeviceC-GigabitEthernet0/1/3] stp enable[*DeviceC-GigabitEthernet0/1/3] commit[~DeviceC-GigabitEthernet0/1/3] quit

        # Enable STP on GE 0/1/1 and GE 0/1/2 on Device D.

        [~DeviceD] interface gigabitethernet 0/1/1[~DeviceD-GigabitEthernet0/1/1] undo shutdown[*DeviceD-GigabitEthernet0/1/1] portswitch[*DeviceD-GigabitEthernet0/1/1] stp enable[*DeviceD-GigabitEthernet0/1/1] quit[*DeviceD] interface gigabitethernet 0/1/2[*DeviceD-GigabitEthernet0/1/2] undo shutdown[*DeviceD-GigabitEthernet0/1/2] portswitch[*DeviceD-GigabitEthernet0/1/2] stp enable[*DeviceD-GigabitEthernet0/1/2] commit[~DeviceD-GigabitEthernet0/1/2] quit

  • x
  • convention:

Created Mar 31, 2019 10:55:53

After a spanning tree protocol 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.
View more
  • x
  • convention:


You need to log in to comment to the post Login | Register

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 " User Agreement."

My Followers

Login and enjoy all the member benefits


Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Please bind your phone number to obtain invitation bonus.