主机评测
MSTP配置示例
4 配置举例
4.1 组网需求
如图所示,当前网络中SwitchA、SwitchB、SwitchC和SwitchD通过环形组网备份链路,同时对两个用户的流量进行负载分担。希望通过运行MSTP协议阻塞特定端口,将环形网络结构修剪成无环路的树形网络结构。
? 部门1和部门2的流量进行负载分担。
? SwitchA和SwitchB分别作为两个部门的根桥和备份根桥。
? SwitchC和SwitchD连接用户的接口GE1/0/3不要参与STP计算。
4.2 配置思路
采用如下的思路配置MSTP:
- 创建VLAN,并把接口加入VLAN。
- 配置模式是MSTP模式。
- 配置域名为RG1,并配置域内VLAN和实例的映射关系。
- 配置SwitchA和SwitchB分别作为两个部门的根桥和备份根桥。
- 统一使用默认路径开销。华为交换机默认的路径开销计算标准使用的是标准的dot1t。GE接口默认路径开销是20000,而Ethernet接口默认路径开销是200000。注意:eNSP模拟器中,STP的路径开销默认是1。
- SwitchC和SwitchD的GE1/0/3端口去使能STP协议。
- SwitchA、SwitchB、SwitchC和SwitchD使能STP协议。
4.3 操作步骤
步骤1:创建VLAN,并把接口加入VLAN。
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 2 to 4094
[SwitchA] interface gigabitethernet0/0/1
[SwitchA-GigabitEthernet0/0/1] port link-type trunk
[SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 4094
[SwitchA-GigabitEthernet0/0/1] quit
[SwitchA] interface gigabitethernet0/0/2
[SwitchA-GigabitEthernet0/0/2] port link-type trunk
[SwitchA-GigabitEthernet0/0/2] port trunk allow-pass vlan 2 to 4094
[SwitchA-GigabitEthernet0/0/2] quit
<HUAWEI> system-view
[HUAWEI] sysname SwitchB
[SwitchB] vlan batch 2 to 4094
[SwitchB] interface gigabitethernet0/0/1
[SwitchB-GigabitEthernet0/0/1] port link-type trunk
[SwitchB-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 4094
[SwitchB-GigabitEthernet0/0/1] quit
[SwitchB] interface gigabitethernet0/0/2
[SwitchB-GigabitEthernet0/0/2] port link-type trunk
[SwitchB-GigabitEthernet0/0/2] port trunk allow-pass vlan 2 to 4094
[SwitchB-GigabitEthernet0/0/2] quit
<HUAWEI> system-view
[HUAWEI] sysname SwitchC
[SwitchC] vlan batch 2 to 4094
[SwitchC] interface gigabitethernet0/0/1
[SwitchC-GigabitEthernet0/0/1] port link-type trunk
[SwitchC-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 4094
[SwitchC-GigabitEthernet0/0/1] quit
[SwitchC] interface gigabitethernet0/0/2
[SwitchC-GigabitEthernet0/0/2] port link-type trunk
[SwitchC-GigabitEthernet0/0/2] port trunk allow-pass vlan 2 to 4094
[SwitchC-GigabitEthernet0/0/2] quit
<HUAWEI> system-view
[HUAWEI] sysname SwitchD
[SwitchD] vlan batch 2 to 4094
[SwitchD] interface gigabitethernet0/0/1
[SwitchD-GigabitEthernet0/0/1] port link-type trunk
[SwitchD-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 4094
[SwitchD-GigabitEthernet0/0/1] quit
[SwitchD] interface gigabitethernet0/0/2
[SwitchD-GigabitEthernet0/0/2] port link-type trunk
[SwitchD-GigabitEthernet0/0/2] port trunk allow-pass vlan 2 to 4094
[SwitchD-GigabitEthernet0/0/2] quit
步骤2:配置模式为MSTP模式。
华为交换机默认是MSTP模式,该步骤可以省略。
[SwitchA] stp mode mstp
[SwitchB] stp mode mstp
[SwitchC] stp mode mstp
[SwitchD] stp mode mstp
步骤3:配置域名为RG1,并配置域内VLAN和实例的映射关系。
注意4台设备的域配置需要完全一致,才可以正确破环。
[SwitchA] stp region-configuration
[SwitchA-mst-region] region-name RG1 //配置域名为RG1
[SwitchA-mst-region] instance 1 vlan 1 to 200 //默认所有VLAN都属于实例0,这里把VLAN1~200映射为实例1,其他VLAN201~4094还是属于实例0
[SwitchA-mst-region] active region-configuration //域内的配置,需要激活才能生效
[SwitchA-mst-region] quit
[SwitchB] stp region-configuration
[SwitchB-mst-region] region-name RG1
[SwitchB-mst-region] instance 1 vlan 1 to 200
[SwitchB-mst-region] active region-configuration
[SwitchB-mst-region] quit
[SwitchC] stp region-configuration
[SwitchC-mst-region] region-name RG1
[SwitchC-mst-region] instance 1 vlan 1 to 200
[SwitchC-mst-region] active region-configuration
[SwitchC-mst-region] quit
[SwitchD] stp region-configuration
[SwitchD-mst-region] region-name RG1
[SwitchD-mst-region] instance 1 vlan 1 to 200
[SwitchD-mst-region] active region-configuration
[SwitchD-mst-region] quit
步骤4:配置根桥和备份根桥。
配置在实例0中SwitchA为根桥,SwitchB为备份根桥。在实例1中SwitchA为备份根桥,SwitchB为根桥。
[SwitchA] stp instance 0 root primary //也可以使用命令stp priority 0 配置优先级为0,和stp root primary的作用是一样的。
[SwitchA] stp instance 1 root secondary //也可以使用命令stp priority 4096 配置优先级为4096,和stp root secondary的作用是一样的。
[SwitchB] stp instance 0 root secondary
[SwitchB] stp instance 1 root primary
步骤5:去使能SwitchB和SwitchC设备GE0/0/3端口的STP功能。
[SwitchC] interface gigabitethernet0/0/3
[SwitchC-GigabitEthernet0/0/3] stp disable
[SwitchC-GigabitEthernet0/0/3] quit
[SwitchD] interface gigabitethernet 0/0/3
[SwitchD-GigabitEthernet0/0/3] stp disable
[SwitchD-GigabitEthernet0/0/3] quit
步骤6:全局使能STP功能。
华为X7系列交换机默认是使能,该步骤可以省略。
[SwitchA] stp enable
[SwitchB] stp enable
[SwitchC] stp enable
[SwitchD] stp enable
步骤7:验证配置结果
查看MSTP简要信息,通过MSTP简要信息可以快速的看出端口的角色和状态。
4.4 配置文件
SwitchA的配置文件
#
sysname SwitchA
#
vlan batch 2 to 4094
#
stp instance 0 root primary
stp instance 1 root secondary
stp enable
#
stp region-configuration
region-name RG1
instance 1 vlan 1 to 200
active region-configuration
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
return
SwitchB的配置文件
#
sysname SwitchB
#
vlan batch 2 to 4094
#
stp instance 0 root secondary
stp instance 1 root primary
stp enable
#
stp region-configuration
region-name RG1
instance 1 vlan 1 to 200
active region-configuration
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
return
SwitchC的配置文件
#
sysname SwitchC
#
vlan batch 2 to 4094
#
stp enable
#
stp region-configuration
region-name RG1
instance 1 vlan 1 to 200
active region-configuration
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
stp disable
#
return
SwitchD的配置文件
#
sysname SwitchD
#
vlan batch 2 to 4094
#
stp mode stp
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
stp disable
#
return