< Home

Example for Configuring RSTP

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 1 compares STP, RSTP, and MSTP.
Table 1 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 RSTP 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, RSTP can be deployed on the network to prevent loops. When loops exist on a network, RSTP blocks a port to eliminate the loops. In Figure 1, SwitchA, SwitchB, SwitchC, and SwitchD running RSTP exchange RSTP BPDUs to discover loops on the network and block ports to prune the network into a loop-free tree network. RSTP prevents infinite looping of packets to ensure packet processing capabilities of switches.

Figure 1 RSTP networking

Configuration Roadmap

The configuration roadmap is as follows:
  1. Configure basic RSTP functions on switching devices of the ring network.
    1. Configure the switching devices on the ring network to work in RSTP 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 RSTP to eliminate loops.

  2. Enable protection functions to protect devices or links. For example, enable root protection on the designed port of the root bridge.

Procedure

  1. Configure basic RSTP functions.

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

      # Configure SwitchA to work in RSTP mode.

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

      # Configure SwitchB to work in RSTP mode.

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

      # Configure SwitchC to work in RSTP mode.

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

      # Configure SwitchD to work in RSTP mode.

      <HUAWEI> system-view
      [HUAWEI] sysname SwitchD
      [SwitchD] stp mode rstp
    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.

      • 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 RSTP to eliminate loops.

      • Configure the ports connected to PCs as edge ports.

        # Configure GigabitEthernet0/0/2 on 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 on 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
        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 RSTP globally on devices.

        # Enable RSTP on SwitchA.

        [SwitchA] stp enable

        # Enable RSTP globally on SwitchB.

        [SwitchB] stp enable

        # Enable RSTP globally on SwitchC.

        [SwitchC] stp enable

        # Enable RSTP globally on SwitchD.

        [SwitchD] stp enable

  2. Enable protection functions. The following uses root protection on the designated port of the root bridge as an example.

    # Configure root protection on GigabitEthernet0/0/1 of SwitchA.

    [SwitchA] interface gigabitethernet 0/0/1
    [SwitchA-GigabitEthernet0/0/1] stp root-protection
    [SwitchA-GigabitEthernet0/0/1] quit

    # Configure root protection on GigabitEthernet0/0/2 of SwitchA.

    [SwitchA] interface gigabitethernet 0/0/2
    [SwitchA-GigabitEthernet0/0/2] stp root-protection
    [SwitchA-GigabitEthernet0/0/2] quit

  3. 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 status and protection type on the ports. The displayed information is as follows:

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

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

    # 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/2        DESI  FORWARDING      NONE     
       0    GigabitEthernet0/0/3        ROOT  FORWARDING      NONE     

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

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

Configuration Files

  • SwitchA configuration file

    #
    sysname SwitchA                 
    #                                
    stp mode rstp                   
    stp instance 0 root primary     
    stp pathcost-standard legacy
    #                                
    interface GigabitEthernet0/0/1  
     stp root-protection             
    #                                
    interface GigabitEthernet0/0/2  
     stp root-protection             
    #
    return
  • SwitchB configuration file

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

    #                                
    sysname SwitchC                                   
    #                                
    stp mode rstp
    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 rstp                   
    stp instance 0 root secondary   
    stp pathcost-standard legacy
    #                                
    return                        

Related Content

Videos

Configuring STP to Prevent Loops

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >