OBJECTIVE
The purpose of this post is to present an introduction to the example for configruing basic RSTP 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 damages MAC address entries.
RSTP can be deployed on a network to eliminate loops by blocking some ports. On the network shown in Figure 1, after RouterA, SwitchA, SwitchB, SwitchC and SwitchD running RSTP discover loops on the network by exchanging information with each other, they trim the ring topology into a loop-free tree topology by blocking an interface. 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 1 - Networking diagram of configuring basic RSTP functions
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure basic RSTP functions, including:
a. Configure the RSTP mode for the ring network.
b. Configure primary and secondary root bridges.
c. Set path costs for ports to block certain ports.
d. Enable RSTP to eliminate loops, including:
Enable RSTP globally.
Enable RSTP on all the interfaces except the interfaces connected to terminals.
RSTP is not required on the interfaces connected to terminals because these interfaces do not need to participate in RSTP calculation.
2. Configure RSTP protection functions, for example, configure root protection on a designated port of a root bridge.
Procedure
1. Configure basic RSTP functions.
a. Configure the RSTP mode for the devices on the ring network.
# Configure the RSTP mode on RouterA.
<Huawei> system-view
[Huawei] sysname RouterA
[RouterA] stp mode rstp
# Configure the RSTP mode on SwitchA, SwitchB, SwitchC and SwitchD.
b. Configure primary and secondary root bridges.
# Configure RouterA as the primary root bridge.
[RouterA] stp root primary
# Configure SwitchA as a second root bridge. (The detailed configuration is not provided here.)
c. Set path costs for the interface to be blocked.
The values of path costs depend on path cost calculation methods. This example uses the Huawei proprietary calculation method and sets the path cost to 200000.
All switching devices on a network must use the same path cost calculation method. Refer to STP List of path costs to get standard of other calculation methods.
# On RouterA, configure the path cost calculation method as the Huawei proprietary method.
[RouterA] stp pathcost-standard legacy
# On SwitchA, SwitchB, SwitchC and SwitchD, configure the path cost calculation method as the Huawei proprietary method. (The detailed configuration is not provided here.)
# As shown in Figure 1, set the path cost of Eth0/0/4 on SwitchC and SwitchD to 200000. (The detailed configuration is not provided here.)
d. Enable RSTP to eliminate loops.
Disable RSTP on interfaces connected to PCs.
# Disable RSTP on interfaces connected to terminals for SwitchC and SwitchD.
Enable RSTP globally.
# Enable RSTP globally on RouterA
[RouterA] stp enable
# Enable RSTP globally on other switching devices.
Enable RSTP on all the interfaces except the interfaces connected to terminals.
# Enable RSTP on RouterA Ethernet2/0/0 and Ethernet2/0/1
[RouterA] interface ethernet 2/0/0
[RouterA-Ethernet2/0/0] stp enable
[RouterA-Ethernet2/0/0] quit
[RouterA] interface ethernet 2/0/1
[RouterA-Ethernet2/0/1] stp enable
[RouterA-Ethernet2/0/1] quit
# Enable STP on all the interfaces except the interfaces connected to terminals for SwitchA, SwitchB, SwitchC and SwitchD.
2. Configure RSTP protection function.
# Enable root protection on Eth2/0/0 and Eth2/0/1 of RouterA.
[RouterA] interface ethernet 2/0/0
[RouterA-Ethernet2/0/0] stp root-protection
[RouterA-Ethernet2/0/0] quit
[RouterA] interface ethernet 2/0/1
[RouterA-Ethernet2/0/1] stp root-protection
[RouterA-Ethernet2/0/1] quit
3. Verify the configuration.
After the previous configurations, run the following commands to verify the configuration when the network is stable:
# Run the display stp brief command on RouterA to view the interface status and protection type. The displayed information is as follows:
[RouterA] display stp brief
MSTID Port Role STP State Protection
0 Ethernet2/0/0 DESI FORWARDING ROOT
0 Ethernet2/0/1 DESI FORWARDING ROOT
After RouterA is configured as a root bridge, Ethernet2/0/0 connected to SwitchA and Ethernet2/0/1 connected to SwitchB are elected as designated ports during spanning tree calculation.
Configuration Files
Configuration file of RouterA
#
sysname RouterA
#
stp mode stp
stp instance 0 root primary
stp pathcost-standard legacy
#
interface Ethernet2/0/0
stp root-protection
#
interface Ethernet2/0/1
stp root-protection
#
return
Configuration file of SwitchA
#
sysname SwitchA
#
stp mode stp
stp instance 0 root secondary
stp pathcost-standard legacy
#
interface Ethernet0/0/1
#
interface Ethernet0/0/2
#
interface Ethernet0/0/3
#
return
Configuration file of SwitchB
#
sysname SwitchB
#
stp mode stp
stp pathcost-standard legacy
#
interface Ethernet0/0/1
#
interface Ethernet0/0/2
#
interface Ethernet0/0/3
#
return
Configuration file of SwitchC
#
sysname SwitchC
#
stp mode stp
stp pathcost-standard legacy
#
interface Ethernet0/0/1
#
interface Ethernet0/0/2
stp disable
#
interface Ethernet0/0/3
stp disable
#
interface Ethernet0/0/4
stp instance 0 cost 200000
#
return
Configuration file of SwitchD
#
sysname SwitchD
#
stp mode stp
stp pathcost-standard legacy
#
interface Ethernet0/0/1
#
interface Ethernet0/0/2
stp disable
#
interface Ethernet0/0/3
stp disable
#
interface Ethernet0/0/4
stp instance 0 cost 200000
#
return
--- End

Thanks




