首先,我们弄清楚STP、RSTP、MSTP区别
    STP:单实例生成树协议;
    RSTP:快速生成树协议;
    MSTP:多实例生成树协议;
    通过STP、RSTP协议可以实现

1.逻辑上防止链路环路;
2.物理上实现链路备份;
通过MSTP协议不但可以实现上述两点,还可以实现负载均衡。

  下面我们通过实验详细讲解MSTP协议, 实验拓扑如下图所示

华为多实例生成树MSTP配置详解_第1张图片
实验目的:
1.使PC1通过SW3的0/0/2接口访问Server1,实现负载均衡;
2.使PC2通过SW3的0/0/3接口访问Server1,实现负载均衡;

第一步,在SW1、SW2、SW3上面分别进行vlan、trunk相关配置

SW1上面配置如下:
[SW1]vlan batch 2 3
[SW1]port-group 1
[SW1-port-group-1]group-member eth0/0/1 eth0/0/2
[SW1-port-group-1]port link-type trunk
[SW1-port-group-1]port trunk allow-pass vlan all

SW2上面配置如下:
[SW2]vlan batch 2 3
[SW2]port-group 1
[SW2-port-group-1]group-member eth0/0/1 eth0/0/3
[SW2-port-group-1]port link-type trunk
[SW2-port-group-1]port trunk allow-pass vlan all

SW3上面配置如下:
[SW3]vlan batch 2 3
[SW3]port-group 1
[SW3-port-group-1]group-member eth0/0/2 eth0/0/3
[SW3-port-group-1]port link-type trunk
[SW3-port-group-1]port trunk allow-pass vlan all

第二步,配置RSTP

[SW1]stp region-configuration
[SW1-mst-region]region-name 1806
[SW1-mst-region]instance 1 vlan 2
[SW1-mst-region]instance 2 vlan 3
[SW1-mst-region]active region-configuration
[SW1]stp instance 1 priority 4096
[SW1]stp instance 2 priority 8192

[SW2]stp region-configuration
[SW2-mst-region]region-name 1806
[SW2-mst-region]instance 1 vlan 2
[SW2-mst-region]instance 2 vlan 3
[SW2-mst-region]active region-configuration
[SW2]stp instance 1 priority 8192
[SW2]stp instance 2 priority 4096

[SW3]stp region-configuration
[SW3-mst-region]region-name 1806
[SW3-mst-region]instance 1 vlan 2
[SW3-mst-region]instance 2 vlan 3
[SW3-mst-region]active region-configuration
第三步,验证查看
[SW1]dis stp brief
MSTID Port Role STP State Protection
0 Ethernet0/0/1 DESI FORWARDING NONE
0 Ethernet0/0/2 DESI FORWARDING NONE
1 Ethernet0/0/1 DESI FORWARDING NONE
1 Ethernet0/0/2 DESI FORWARDING NONE
2 Ethernet0/0/1 DESI FORWARDING NONE
2 Ethernet0/0/2 DESI FORWARDING NONE
[SW2]display stp brief
MSTID Port Role STP State Protection
0 Ethernet0/0/1 ROOT FORWARDING NONE
0 Ethernet0/0/3 DESI FORWARDING NONE
1 Ethernet0/0/1 ROOT FORWARDING NONE
1 Ethernet0/0/3 DESI FORWARDING NONE
2 Ethernet0/0/1 DESI FORWARDING NONE
2 Ethernet0/0/3 DESI FORWARDING NONE
[SW3]dis stp brief
MSTID Port Role STP State Protection
0 Ethernet0/0/2 ROOT FORWARDING NONE
0 Ethernet0/0/3 ALTE DISCARDING NONE
1 Ethernet0/0/2 ROOT FORWARDING NONE
1 Ethernet0/0/3 ALTE DISCARDING NONE
2 Ethernet0/0/2 ALTE DISCARDING NONE
2 Ethernet0/0/3 ROOT FORWARDING NONE
验证成功,对于PC1来说,所连接接口属于vlan2,对于vlan2来说SW3的 Ethernet0/0/3 是ALTE,即阻塞状态,因此PC1通过SW3的0/0/2接口访问Server1;对于PC2来说,所连接接口属于vlan3,对于vlan3来说SW3的 Ethernet0/0/2 是ALTE,即阻塞状态,因此PC2通过SW3的0/0/3接口访问Server1.