Example for Configuring MSTP
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 master and the others are the backup. Loops occur, causing broadcast storms or damaging MAC addresses. After the network is planned, deploy MSTP on the network to prevent loops. MSTP blocks redundant links and prunes a network into a tree topology free from loops.
On the network shown in Figure 10-20, SwitchA, SwitchB, SwitchC, and SwitchD run MSTP. To load balance traffic from VLANs 2 to 10 and VLANs 11 to 20, use MSTP multi-instance. You can configure a VLAN mapping table to associate VLANs with MSTIs.
Configuration Roadmap
The configuration roadmap is as follows:
Configure basic MSTP functions on the switching device on the ring network.
Configure protection functions to protect devices or links. You can configure root protection on the designated port of the root bridge.
Configure Layer 2 forwarding.
Procedure
- Configure basic MSTP functions.
Configure SwitchA, SwitchB, SwitchC, and SwitchD in the same MST region named RG1 and create MSTI 1 and MSTI 2.
Two switching devices belong to the same MST region when they have the same:Name of the MST region
Mapping between VLANs and MSTIs
A VLAN cannot be mapped to multiple MSTIs. If you map a VLAN that has already been mapped to an MSTI to another MSTI, the original mapping will be deleted.
Revision level of the MST region
# Configure an MST region on SwitchA.
<HUAWEI> system-view [~HUAWEI] sysname SwitchA [*HUAWEI] commit [~SwitchA] stp region-configuration [~SwitchA-mst-region] region-name RG1 [*SwitchA-mst-region] instance 1 vlan 2 to 10 [*SwitchA-mst-region] instance 2 vlan 11 to 20 [*SwitchA-mst-region] commit [~SwitchA-mst-region] quit
# Configure an MST region on SwitchB.
<HUAWEI> system-view [~HUAWEI] sysname SwitchB [*HUAWEI] commit [~SwitchB] stp region-configuration [~SwitchB-mst-region] region-name RG1 [*SwitchB-mst-region] instance 1 vlan 2 to 10 [*SwitchB-mst-region] instance 2 vlan 11 to 20 [*SwitchB-mst-region] commit [~SwitchB-mst-region] quit
# Configure an MST region on SwitchC.
<HUAWEI> system-view [~HUAWEI] sysname SwitchC [*HUAWEI] commit [~SwitchC] stp region-configuration [~SwitchC-mst-region] region-name RG1 [*SwitchC-mst-region] instance 1 vlan 2 to 10 [*SwitchC-mst-region] instance 2 vlan 11 to 20 [*SwitchC-mst-region] commit [~SwitchC-mst-region] quit
# Configure an MST region on SwitchD.
<HUAWEI> system-view [~HUAWEI] sysname SwitchD [*HUAWEI] commit [~SwitchD] stp region-configuration [~SwitchD-mst-region] region-name RG1 [*SwitchD-mst-region] instance 1 vlan 2 to 10 [*SwitchD-mst-region] instance 2 vlan 11 to 20 [*SwitchD-mst-region] commit [~SwitchD-mst-region] quit
In the MST region RG1, configure the root bridge and secondary root bridge in MSTI 1 and MSTI 2.
Configure the root bridge and secondary root bridge in MSTI 1.
# Configure SwitchA as the root bridge in MSTI 1.
[~SwitchA] stp instance 1 root primary [*SwitchA] commit
# Configure SwitchB as the secondary root bridge in MSTI 1.
[~SwitchB] stp instance 1 root secondary [*SwitchB] commit
Configure the root bridge and secondary root bridge in MSTI 2.
# Configure SwitchB as the root bridge in MSTI 2.
[~SwitchB] stp instance 2 root primary [*SwitchB] commit
# Configure SwitchA as the secondary root bridge in MSTI 2.
[~SwitchA] stp instance 2 root secondary [*SwitchA] commit
Set the path costs of the ports to be blocked in MSTI 1 and MSTI 2 to be greater than the default value.
The path cost values depend on path cost calculation methods. This example uses the Huawei calculation method as an example to set the path cost to 20000 for the ports to be blocked. If another path cost calculation method is used, see stp pathcost-standard.
All switching devices on a network must use the same path cost calculation method.
# Configure SwitchA to use Huawei calculation method to calculate the path cost.
[~SwitchA] stp pathcost-standard legacy [*SwitchA] commit
# Configure SwitchB to use Huawei calculation method to calculate the path cost.
[~SwitchB] stp pathcost-standard legacy [*SwitchB] commit
# Configure SwitchC to use Huawei calculation method to calculate the path cost, and set the path cost of 10GE1/0/2 in MSTI 2 to 20000.
[~SwitchC] stp pathcost-standard legacy [*SwitchC] interface 10ge 1/0/2 [*SwitchC-10GE1/0/2] stp instance 2 cost 20000 [*SwitchC-10GE1/0/2] commit [~SwitchC-10GE1/0/2] quit
# Configure SwitchD to use Huawei calculation method to calculate the path cost, and set the path cost of 10GE1/0/2 in MSTI 1 to 20000.
[~SwitchD] stp pathcost-standard legacy [*SwitchD] interface 10ge 1/0/2 [*SwitchD-10GE1/0/2] stp instance 1 cost 20000 [*SwitchD-10GE1/0/2] commit [~SwitchD-10GE1/0/2] quit
Enable MSTP to eliminate loops.
Enable MSTP globally.
# Enable MSTP on SwitchA.
[~SwitchA] stp enable [*SwitchA] commit
# Enable MSTP on SwitchB.
[~SwitchB] stp enable [*SwitchB] commit
# Enable MSTP on SwitchC.
[~SwitchC] stp enable [*SwitchC] commit
# Enable MSTP on SwitchD.
[~SwitchD] stp enable [*SwitchD] commit
Disable MSTP on the interface connected to terminals.
# Disable STP on 10GE1/0/1 of SwitchC.
[~SwitchC] interface 10ge 1/0/1 [~SwitchC-10GE1/0/1] stp disable [*SwitchC-10GE1/0/1] commit [~SwitchC-10GE1/0/1] quit
# Disable STP on 10GE1/0/1 of SwitchD.
[~SwitchD] interface 10ge 1/0/1 [~SwitchD-10GE1/0/1] stp disable [*SwitchD-10GE1/0/1] commit [~SwitchD-10GE1/0/1] quit
- Configure root protection on the designated port of the
root bridge.
# Enable root protection on 10GE1/0/1 of SwitchA.
[~SwitchA] interface 10ge 1/0/1 [~SwitchA-10GE1/0/1] stp root-protection [*SwitchA-10GE1/0/1] commit [~SwitchA-10GE1/0/1] quit
# Enable root protection on 10GE1/0/1 of SwitchB.
[~SwitchB] interface 10ge 1/0/1 [~SwitchB-10GE1/0/1] stp root-protection [*SwitchB-10GE1/0/1] commit [~SwitchB-10GE1/0/1] quit
- Configure Layer 2 forwarding on devices on the ring network.
Create VLANs 2 to 20 on SwitchA, SwitchB, SwitchC, and SwitchD.
# Create VLANs 2 to 20 on SwitchA.
[~SwitchA] vlan batch 2 to 20 [*SwitchA] commit
# Create VLANs 2 to 20 on SwitchB.
[~SwitchB] vlan batch 2 to 20 [*SwitchB] commit
# Create VLANs 2 to 20 on SwitchC.
[~SwitchC] vlan batch 2 to 20 [*SwitchC] commit
# Create VLANs 2 to 20 on SwitchD.
[~SwitchD] vlan batch 2 to 20 [*SwitchD] commit
Add ports on switching devices to VLANs.
# Add 10GE1/0/1 on SwitchA to VLANs 2 to 20.
[~SwitchA] interface 10ge 1/0/1 [~SwitchA-10GE1/0/1] port link-type trunk [*SwitchA-10GE1/0/1] port trunk allow-pass vlan 2 to 20 [*SwitchA-10GE1/0/1] commit [~SwitchA-10GE1/0/1] quit
# Add 10GE1/0/2 on SwitchA to VLANs 2 to 20.
[~SwitchA] interface 10ge 1/0/2 [~SwitchA-10GE1/0/2] port link-type trunk [*SwitchA-10GE1/0/2] port trunk allow-pass vlan 2 to 20 [*SwitchA-10GE1/0/2] commit [~SwitchA-10GE1/0/2] quit
# Add 10GE1/0/1 on SwitchB to VLANs 2 to 20.
[~SwitchB] interface 10ge 1/0/1 [~SwitchB-10GE1/0/1] port link-type trunk [*SwitchB-10GE1/0/1] port trunk allow-pass vlan 2 to 20 [*SwitchB-10GE1/0/1] commit [~SwitchB-10GE1/0/1] quit
# Add 10GE1/0/2 on SwitchB to VLANs 2 to 20.
[~SwitchB] interface 10ge 1/0/2 [~SwitchB-10GE1/0/2] port link-type trunk [*SwitchB-10GE1/0/2] port trunk allow-pass vlan 2 to 20 [*SwitchB-10GE1/0/2] commit [~SwitchB-10GE1/0/2] quit
# Add 10GE1/0/1 on SwitchC to VLAN 2.
[~SwitchC] interface 10ge 1/0/1 [~SwitchC-10GE1/0/1] port link-type access [*SwitchC-10GE1/0/1] port default vlan 2 [*SwitchC-10GE1/0/1] commit [~SwitchC-10GE1/0/1] quit
# Add 10GE1/0/2 on SwitchC to VLANs 2 to 20.
[~SwitchC] interface 10ge 1/0/2 [~SwitchC-10GE1/0/2] port link-type trunk [*SwitchC-10GE1/0/2] port trunk allow-pass vlan 2 to 20 [*SwitchC-10GE1/0/2] commit [~SwitchC-10GE1/0/2] quit
# Add 10GE1/0/3 on SwitchC to VLANs 2 to 20.
[~SwitchC] interface 10ge 1/0/3 [~SwitchC-10GE1/0/3] port link-type trunk [*SwitchC-10GE1/0/3] port trunk allow-pass vlan 2 to 20 [*SwitchC-10GE1/0/3] commit [~SwitchC-10GE1/0/3] quit
# Add 10GE1/0/1 on SwitchD to VLAN 11.
[~SwitchD] interface 10ge 1/0/1 [~SwitchD-10GE1/0/1] port link-type access [*SwitchD-10GE1/0/1] port default vlan 11 [*SwitchD-10GE1/0/1] commit [~SwitchD-10GE1/0/1] quit
# Add 10GE1/0/2 on SwitchD to VLANs 2 to 20.
[~SwitchD] interface 10ge 1/0/2 [~SwitchD-10GE1/0/2] port link-type trunk [*SwitchD-10GE1/0/2] port trunk allow-pass vlan 2 to 20 [*SwitchD-10GE1/0/2] commit [~SwitchD-10GE1/0/2] quit
# Add 10GE1/0/3 on SwitchD to VLANs 2 to 20.
[~SwitchD] interface 10ge 1/0/3 [~SwitchD-10GE1/0/3] port link-type trunk [*SwitchD-10GE1/0/3] port trunk allow-pass vlan 2 to 20 [*SwitchD-10GE1/0/3] commit [~SwitchD-10GE1/0/3] quit
- Verify the configuration.
After the preceding configurations are complete and the network topology becomes stable, perform the following operations to verify the configuration.
MSTI 1 and MSTI 2 are used as examples. You do not need to check the interface status in MSTI 0.
# Run the display stp brief command on SwitchA to view the status and protection mode on the ports. Output similar to the following 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 none 2 disable 1 10GE1/0/1 DESI forwarding root 2 disable 1 10GE1/0/2 DESI forwarding none 2 disable 2 10GE1/0/1 DESI forwarding root 2 disable 2 10GE1/0/2 ROOT forwarding none 2 disable
In MSTI 1, 10GE1/0/1 and 10GE1/0/2 are designated ports because SwitchA is the root bridge. In MSTI 2, 10GE1/0/1 on SwitchA is the designated port and 10GE1/0/2 is the root port.
# Run the display stp brief command on SwitchB. Output similar to the following is displayed:
[~SwitchB] display stp brief MSTID Port Role STP State Protection Cost Edged 0 10GE1/0/1 DESI forwarding root 2 disable 0 10GE1/0/2 ROOT forwarding none 2 disable 1 10GE1/0/1 DESI forwarding root 2 disable 1 10GE1/0/2 ROOT forwarding none 2 disable 2 10GE1/0/1 DESI forwarding root 2 disable 2 10GE1/0/2 DESI forwarding none 2 disable
In MSTI 2, 10GE1/0/1 and 10GE1/0/2 are designated ports because SwitchB is the root bridge. In MSTI 1, 10GE1/0/1 on SwitchB is the designated port and 10GE1/0/2 is the root port.
# Run the display stp interface brief command on SwitchC. Output similar to the following is displayed:
[~SwitchC] display stp interface 10ge 1/0/3 brief MSTID Port Role STP State Protection Cost Edged 0 10GE1/0/3 ROOT forwarding none 2 disable 1 10GE1/0/3 ROOT forwarding none 2 disable 2 10GE1/0/3 ROOT forwarding none 2 disable
[~SwitchC] display stp interface 10ge 1/0/2 brief MSTID Port Role STP State Protection Cost Edged 0 10GE1/0/2 DESI forwarding none 2 disable 1 10GE1/0/2 DESI forwarding none 2 disable 2 10GE1/0/2 ALTE discarding none 20000 disable
10GE1/0/3 on SwitchC is the root port in MSTI 1 and MSTI 2. 10GE1/0/2 on SwitchC is the designated port in MSTI 1 but is blocked in MSTI 2.
# Run the display stp interface brief command on SwitchD. Output similar to the following is displayed:
[~SwitchD] display stp interface 10ge 1/0/3 brief MSTID Port Role STP State Protection Cost Edged 0 10GE1/0/3 ALTE discarding none 2 disable 1 10GE1/0/3 ROOT forwarding none 2 disable 2 10GE1/0/3 ROOT forwarding none 2 disable
[~SwitchD] display stp interface 10ge 1/0/2 brief MSTID Port Role STP State Protection Cost Edged 0 10GE1/0/2 ROOT forwarding none 2 disable 1 10GE1/0/2 ALTE discarding none 20000 disable 2 10GE1/0/2 DESI forwarding none 2 disable
10GE1/0/3 on SwitchD is the root port in MSTI 1 and MSTI 2. 10GE1/0/2 on SwitchD is the blocked port in MSTI 1 and is the designated port in MSTI 2.
Configuration Files
SwitchA configuration file
# sysname SwitchA # vlan batch 2 to 20 # stp instance 1 root primary stp instance 2 root secondary stp pathcost-standard legacy # stp region-configuration region-name RG1 instance 1 vlan 2 to 10 instance 2 vlan 11 to 20 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 2 to 20 stp root-protection # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 2 to 20 # return
SwitchB configuration file
# sysname SwitchB # vlan batch 2 to 20 # stp instance 1 root secondary stp instance 2 root primary stp pathcost-standard legacy # stp region-configuration region-name RG1 instance 1 vlan 2 to 10 instance 2 vlan 11 to 20 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 2 to 20 stp root-protection # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 2 to 20 # return
SwitchC configuration file
# sysname SwitchC # vlan batch 2 to 20 # stp pathcost-standard legacy # stp region-configuration region-name RG1 instance 1 vlan 2 to 10 instance 2 vlan 11 to 20 # interface 10GE1/0/1 port default vlan 2 stp disable # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 2 to 20 stp instance 2 cost 20000 # interface 10GE1/0/3 port link-type trunk port trunk allow-pass vlan 2 to 20 # return
SwitchD configuration file
# sysname SwitchD # vlan batch 2 to 20 # stp pathcost-standard legacy # stp region-configuration region-name RG1 instance 1 vlan 2 to 10 instance 2 vlan 11 to 20 # interface 10GE1/0/1 port default vlan 11 stp disable # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 2 to 20 stp instance 1 cost 20000 # interface 10GE1/0/3 port link-type trunk port trunk allow-pass vlan 2 to 20 # return