Example for Configuring STP

87 0 0 0

Example for Configuring STP

Overview

Generally, redundant links are used on an Ethernet switching network to provide link backup and enhance network reliability. The use of redundant links, however, may produce loops, causing broadcast storms and rendering the MAC address table unstable. As a result, the communication quality deteriorates, and communication services may be interrupted. The Spanning Tree Protocol (STP) is used to solve these problems. STP prevents loops. Devices running STP discover loops on the network by exchanging information with each other, and block some ports to eliminate loops.

STP refers to 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.

MSTP is compatible with RSTP and STP, and RSTP is compatible with STP. Table 6-8 compares STP, RSTP, and MSTP.
Table 6-8  Comparisons among STP, RSTP, and MSTP

Spanning Tree Protocol

Characteristics

Application Scenario

STP

  • Forms a loop-free tree to prevent broadcast storms and implement redundancy.

  • Provides slow convergence.

User or service traffic does not need to be differentiated, and all VLANs share a spanning tree.

RSTP

  • Forms a loop-free tree to prevent broadcast storms and implement redundancy.
  • Provides fast convergence.

MSTP

  • Forms multiple loop-free trees to prevent broadcast storms and implement redundancy.
  • Provides fast convergence.
  • Implements load balancing among VLANs and forwards traffic in different VLANs along different paths.

User or service traffic needs to be differentiated and load balanced. Traffic from different VLANs is forwarded through different spanning trees that are independent of each other.

Configuration Notes

  • This example applies to all versions of all S series switches.
  • The ports connected to terminals do not participate in STP calculation. Therefore, configure the ports as edge ports or disable STP on the ports.

Networking Requirements

To implement redundancy on a complex network, network designers tend to deploy multiple physical links between two devices, one of which is the primary link and the others are backup links. Loops may occur, causing broadcast storms or rendering the MAC address table unstable.

After a network designer deploys a network, STP can be deployed on the network to prevent loops. When loops exist on a network, STP blocks a port to eliminate the loops. In Figure 6-23, SwitchA, SwitchB, SwitchC, and SwitchD running STP exchange STP BPDUs to discover loops on the network and block ports to prune the network into a loop-free tree network. STP prevents infinite looping of packets to ensure packet processing capabilities of switches.

Figure 6-23  STP networking 
imgDownload?uuid=d8c8ca6d1d8548b6bf639c5

Configuration Roadmap

The configuration roadmap is as follows:
  1. Configure the switching devices on the ring network to work in STP mode.

  2. Configure the root bridge and secondary root bridge.

  3. Configure the path cost of a port so that the port can be blocked.

  4. Enable STP to eliminate loops.

Procedure

  1. Configure basic STP functions.

    1. Configure the switching devices on the ring network to work in STP mode.

      # Configure SwitchA to work in STP mode.

      <HUAWEI> system-view[HUAWEI] sysname SwitchA[SwitchA] stp mode stp

      # Configure SwitchB to work in STP mode.

      <HUAWEI> system-view[HUAWEI] sysname SwitchB[SwitchB] stp mode stp

      # Configure SwitchC to work in STP mode.

      <HUAWEI> system-view[HUAWEI] sysname SwitchC[SwitchC] stp mode stp

      # Configure SwitchD to work in STP mode.

      <HUAWEI> system-view[HUAWEI] sysname SwitchD[SwitchD] stp mode stp
    2. Configure the root bridge and secondary root bridge.

      # Configure SwitchA as the root bridge.

      [SwitchA] stp root primary

      # Configure SwitchD as the secondary root bridge.

      [SwitchD] stp root secondary
    3. Configure the path cost of a port so that the port can be blocked.

      imgDownload?uuid=2302d70f6f274617bedba28 NOTE:
      • The path cost range depends on the algorithm. Huawei's proprietary algorithm is used as an example. Set the path costs of the ports to be blocked to 20000.

      • Switching devices on the same network must use the same algorithm to calculate the path cost of ports.

      # Configure SwitchA to use Huawei's proprietary algorithm to calculate the path cost.

      [SwitchA] stp pathcost-standard legacy

      # Configure SwitchB to use Huawei's proprietary algorithm to calculate the path cost.

      [SwitchB] stp pathcost-standard legacy

      # Configure SwitchC to use Huawei's proprietary algorithm to calculate the path cost.

      [SwitchC] stp pathcost-standard legacy

      # Set the path cost of GigabitEthernet0/0/1 on SwitchC to 20000.

      [SwitchC] interface gigabitethernet 0/0/1[SwitchC-GigabitEthernet0/0/1] stp cost 20000[SwitchC-GigabitEthernet0/0/1] quit

      # Configure SwitchD to use Huawei's proprietary algorithm to calculate the path cost.

      [SwitchD] stp pathcost-standard legacy
    4. Enable STP to eliminate loops.

      • Configure the ports connected to PCs as edge ports.

        # Configure GigabitEthernet0/0/2 of SwitchB as an edge port.

        [SwitchB] interface gigabitethernet 0/0/2[SwitchB-GigabitEthernet0/0/2] stp edged-port enable[SwitchB-GigabitEthernet0/0/2] quit

        (Optional) Configure BPDU protection on SwitchB.

        [SwitchB] stp bpdu-protection

        # Configure GigabitEthernet0/0/2 of SwitchC as an edge port.

        [SwitchC] interface gigabitethernet 0/0/2[SwitchC-GigabitEthernet0/0/2] stp edged-port enable[SwitchC-GigabitEthernet0/0/2] quit

        (Optional) Configure BPDU protection on SwitchC.

        [SwitchC] stp bpdu-protection
        imgDownload?uuid=2302d70f6f274617bedba28 NOTE:
        If edge ports are connected to network devices that have STP enabled and BPDU protection is enabled, the edge ports will be shut down and their attributes remain unchanged after they receive BPDUs.
      • Enable STP globally on devices.

        # Enable STP globally on SwitchA.

        [SwitchA] stp enable

        # Enable STP globally on SwitchB.

        [SwitchB] stp enable

        # Enable STP globally on SwitchC.

        [SwitchC] stp enable

        # Enable STP globally on SwitchD.

        [SwitchD] stp enable

  2. Verify the configuration.

    After the configuration is complete and the network topology becomes stable, perform the following operations to verify the configuration.

    # Run the display stp brief command on SwitchA to view the port status and protection type. The displayed information is as follows:

    [SwitchA] display stp brief
     MSTID  Port                        Role  STP State     Protection
       0    GigabitEthernet0/0/1        DESI  FORWARDING      NONE
       0    GigabitEthernet0/0/2        DESI  FORWARDING      NONE

    After SwitchA is configured as the root bridge, GigabitEthernet0/0/2 and GigabitEthernet0/0/1 connected to SwitchB and SwitchD are selected as designed ports.

    # Run the display stp interface gigabitethernet 0/0/1 brief command on SwitchB to check the status of GigabitEthernet0/0/1. The following information is displayed:

    [SwitchB] display stp interface gigabitethernet 0/0/1 brief
     MSTID  Port                        Role  STP State     Protection
       0    GigabitEthernet0/0/1        DESI  FORWARDING      NONE      

    GigabitEthernet0/0/1 becomes the designated port and is in FORWARDING state.

    # Run the display stp brief command on SwitchC to check the port status.

    [SwitchC] display stp brief
     MSTID  Port                        Role  STP State     Protection
       0    GigabitEthernet0/0/1        ALTE  DISCARDING      NONE     
       0    GigabitEthernet0/0/3        ROOT  FORWARDING      NONE      

    GigabitEthernet0/0/3 becomes the root port and is in FORWARDING state.

    GigabitEthernet0/0/1 becomes the alternate port and is in DISCARDING state.

Configuration Files

  • SwitchA configuration file

    #
    sysname SwitchA  
    #
    stp mode stp
    stp instance 0 root primary 
    stp pathcost-standard legacy
    #
    return
  • SwitchB configuration file

    # 
    sysname SwitchB   
    # 
    stp mode stp   
    stp bpdu-protection
    stp pathcost-standard legacy
    #  
    interface GigabitEthernet0/0/2   
     stp edged-port enable 
    #  
    return                    
  • SwitchC configuration file

    # 
    sysname SwitchC  
    #  
    stp mode stp
    stp bpdu-protection 
    stp pathcost-standard legacy
    #  
    interface GigabitEthernet0/0/1          
     stp instance 0 cost 20000 
    #  
    interface GigabitEthernet0/0/2     
     stp edged-port enable 
    #  
    return           
  • SwitchD configuration file

    # 
    sysname SwitchD 
    # 
    stp mode stp  
    stp instance 0 root secondary      
    stp pathcost-standard legacy
    #   
    return 

See more please click 

https://support.huawei.com/enterprise/en/doc/EDOC1000069520/9aadccc0/comprehensive-configuration-examples


  • 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