思科设备参考:
一,技术简介
MSTP(多生成树协议),MSTP解决了STP和RSTP没有考虑vlan的问题,STP和RSTP将所有的vlan共享为一个生成树实例,无法实现负载分担,这样就导致了网络中一些设备出现闲置状态,没有流量通过。MSTP将这个交换网络分成多个生成树,每一棵树对应一个实例,每一个实例之间对应多个vlan,实例与实例之间互不影响。
二,实验目的
要求
① 所有交换机都在 "A" 这个域上,修订级别为1。
② vlan10对应实例10,根网桥在Switch1上。vlan20对应实例20,根网桥在Switch2上。
③ PC1能够走Switch3---->Switch1----->Router成功访问PC2,最短路径优先,PC2也如此
三,配置命令
1,基础配置
Router
<Huawei>system-view
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.10.10 24
[Huawei-GigabitEthernet0/0/0]quit
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.20.20 24
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]display current-configuration
Switch1
<Huawei>system-view
[Huawei]undo info-center enable
[Huawei]vlan batch 10 20
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type trunk
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 20
[Huawei-GigabitEthernet0/0/3]quit
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type hybrid
[Huawei-GigabitEthernet0/0/2]port hybrid untagged vlan 10
[Huawei-GigabitEthernet0/0/2]port hybrid pvid vlan 10
[Huawei-GigabitEthernet0/0/2]quit
[Huawei]display current-configuration
Switch2
<Huawei>system-view
[Huawei]undo info-center enable
[Huawei]vlan batch 10 20
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type trunk
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 20
[Huawei-GigabitEthernet0/0/3]quit
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type hybrid
[Huawei-GigabitEthernet0/0/2]port hybrid untagged vlan 10
[Huawei-GigabitEthernet0/0/2]port hybrid pvid vlan 10
[Huawei-GigabitEthernet0/0/2]quit
[Huawei]display current-configuration
Switch3
<Huawei>system-view
[Huawei]undo info-center enable
[Huawei]vlan batch 10 20
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type access
[Huawei-GigabitEthernet0/0/1]port default vlan 10
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 20
[Huawei-GigabitEthernet0/0/2]quit
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type trunk
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 20
[Huawei-GigabitEthernet0/0/3]quit
[Huawei]int g0/0/4
[Huawei-GigabitEthernet0/0/4]port link-type trunk
[Huawei-GigabitEthernet0/0/4]port trunk allow-pass vlan 10 20
[Huawei-GigabitEthernet0/0/4]quit
[Huawei]display current-configuration
以上配置好了以后,其实PC1和PC2是可以ping通的,因为整个网络就只存在一个生成树,且无环路,但是走的路可能不是最优的,有一些链路也存在闲置状态,完全没有达到负载分担的效果。
2,MSTP配置
所有的交换机都要配置MSTP
Switch1
[Huawei]stp mode mstp
[Huawei]stp region-configuration
[Huawei-mst-region]region-name myRegion
[Huawei-mst-region]revision-level 1
[Huawei-mst-region]instance 10 vlan 10
[Huawei-mst-region]instance 20 vlan 20
[Huawei-mst-region]active region-configuration
[Huawei-mst-region]quit
[Huawei]stp instance 10 root primary
[Huawei]stp instance 20 root secondary
[Huawei]display current-configuration
Switch2
[Huawei]stp mode mstp
[Huawei]stp region-configuration
[Huawei-mst-region]region-name myRegion
[Huawei-mst-region]revision-level 1
[Huawei-mst-region]instance 10 vlan 10
[Huawei-mst-region]instance 20 vlan 20
[Huawei-mst-region]active region-configuration
[Huawei-mst-region]quit
[Huawei]stp instance 10 root secondary
[Huawei]stp instance 20 root primary
[Huawei]display current-configuration
Switch3
[Huawei]stp mode mstp
[Huawei]stp region-configuration
[Huawei-mst-region]region-name myRegion
[Huawei-mst-region]revision-level 1
[Huawei-mst-region]instance 10 vlan 10
[Huawei-mst-region]instance 20 vlan 20
[Huawei-mst-region]active region-configuration
[Huawei-mst-region]quit
[Huawei]display stp brief
对于实例10 g0/0/4为阻塞端口,对于实例20 g0/0/3为阻塞端口, 这样,就确保了vlan10 的数据只能够经过Switch3--->Switch1--->Router,效果达到。
四,实验测试
利用PC1连续 ping 网关进行测试
PC>ping 192.168.20.20 -t
Switch3上的g0/0/3端口抓包测试 有流量通过
Switch3上的g0/0/4端口抓包测试 没有流量通过