Example for Configuring RSTP
Networking Requirements
On a complex network, multiple physical links are often deployed between two devices for link redundancy (one as the active link and the others as standby links). However, redundant links may cause loops on the network, which result in broadcast storms and unstable MAC address entries.
RSTP can be deployed on a network to eliminate loops by blocking ports. In Figure 9-18, a loop exists on the network, and SwitchA, SwitchB, SwitchC, and SwitchD are all running RSTP. These devices exchange BPDUs to discover the loops and block the appropriate ports in order to trim the ring topology into a loop-free tree topology, improving packet processing performance.
Configuration Roadmap
Configure the RSTP mode for the devices on the ring network.
Configure the root bridge and secondary root bridge.
Set a path cost for the ports to be blocked.
- Enable RSTP to eliminate loops.
The ports connected to servers do not participate in RSTP calculation. Disable RSTP on these ports.
Configure protection functions to protect devices or links.
Verify the configuration.
Procedure
- Configure the RSTP mode for the devices on the ring network. The configurations on SwitchB, SwitchC, and SwitchD are similar to the configurations on SwitchA, and are not mentioned here.
<HUAWEI> system-view [~HUAWEI] sysname SwitchA [*HUAWEI] commit [~SwitchA] stp mode rstp [*SwitchA] commit
- Configure the root bridge and secondary root bridge.
# Configure SwitchA as the root bridge.
[~SwitchA] stp root primary [*SwitchA] commit
# Configure SwitchB as the secondary root bridge.
[~SwitchB] stp root secondary [*SwitchB] commit
- Set a path cost for the ports to be blocked.
The path cost value range depends on path cost calculation methods, which must be the same on all switches. This example uses the Huawei proprietary calculation method.
# On SwitchA, set the path cost calculation method to the Huawei proprietary method.
[~SwitchA] stp pathcost-standard legacy [*SwitchA] commit
# On SwitchB, set the path cost calculation method to the Huawei proprietary method.
[~SwitchB] stp pathcost-standard legacy [*SwitchB] commit
# Set the path cost of 10GE1/0/1 on SwitchC to 20000.
[~SwitchC] stp pathcost-standard legacy [*SwitchC] interface 10ge 1/0/1 [*SwitchC-10GE1/0/1] stp cost 20000 [*SwitchC-10GE1/0/1] commit [~SwitchC-10GE1/0/1] quit
# On SwitchD, set the path cost calculation method to the Huawei proprietary method.
[~SwitchD] stp pathcost-standard legacy [*SwitchD] commit
- Enable RSTP to eliminate loops.
Disable RSTP on the ports connected to servers.
# Disable RSTP on 10GE1/0/2 of SwitchB.
[~SwitchB] interface 10ge 1/0/2 [~SwitchB-10GE1/0/2] stp disable [*SwitchB-10GE1/0/2] commit [~SwitchB-10GE1/0/2] quit
# Disable RSTP on 10GE1/0/2 of SwitchC.
[~SwitchC] interface 10ge 1/0/2 [~SwitchC-10GE1/0/2] stp disable [*SwitchC-10GE1/0/2] commit [~SwitchC-10GE1/0/2] quit
Enable RSTP globally on devices.
[~SwitchA] stp enable [*SwitchA] commit
[~SwitchB] stp enable [*SwitchB] commit
[~SwitchC] stp enable [*SwitchC] commit
[~SwitchD] stp enable [*SwitchD] commit
- Configure root protection on the designated ports of the root bridge.
# Configure root protection on 10GE1/0/1 and 10GE1/0/2 of SwitchA.
[~SwitchA] interface 10ge 1/0/1 [~SwitchA-10GE1/0/1] stp root-protection [*SwitchA-10GE1/0/1] quit [*SwitchA] interface 10ge 1/0/2 [*SwitchA-10GE1/0/2] stp root-protection [*SwitchA-10GE1/0/2] quit [*SwitchA] commit
- Verify the configuration.
After the preceding configuration is complete and the network becomes stable, perform the following operations to verify the configuration:
# Run the display stp brief command on SwitchA to view the states and protection type on RSTP ports. The following information is displayed:
[~SwitchA] display stp brief MSTID Port Role STP State Protection Cost Edged 0 10GE1/0/1 DESI forwarding root 2 disable 0 10GE1/0/2 DESI forwarding root 2 disable
After SwitchA is configured as the root bridge, 10GE1/0/2 connected to SwitchB and 10GE1/0/1 connected to SwitchD are elected as designated ports through spanning tree calculation and configured with root protection.
# Run the display stp interface 10GE 1/0/1 brief command on SwitchB to view the role and state of 10GE1/0/1. The following information is displayed:
[~SwitchB] display stp interface 10ge 1/0/1 brief MSTID Port Role STP State Protection Cost Edged 0 10GE1/0/1 DESI forwarding none 2 disable
10GE1/0/1 is elected as a designated port and is in Forwarding state.
# Run the display stp brief command on SwitchC to check the port roles and states. The following information is displayed:
[~SwitchC] display stp brief MSTID Port Role STP State Protection Cost Edged 0 10GE1/0/1 ALTE discarding none 20000 disable 0 10GE1/0/3 ROOT forwarding none 2 disable
10GE1/0/1 is elected as an alternate port and is in Discarding state.
10GE1/0/3 is elected as a 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 10GE1/0/1 stp root-protection # interface 10GE1/0/2 stp root-protection # return
SwitchB configuration file
# sysname SwitchB # stp mode rstp stp instance 0 root secondary stp pathcost-standard legacy # interface 10GE1/0/2 stp disable # return
SwitchC configuration file
# sysname SwitchC # stp mode rstp stp pathcost-standard legacy # interface 10GE1/0/1 stp instance 0 cost 20000 # interface 10GE1/0/2 stp disable # return
SwitchD configuration file
# sysname SwitchD # stp mode rstp stp pathcost-standard legacy # return