1.MSTP(多生成树)可以更灵活的创建与管理不同的VLAN通信;交换机是自带STP功能的,开机加电直接启动STP功能,作用:防止数据在交换网络中无限循环从而产生交换网络的瘫痪,交换机全部死机。(也就是广播风暴)
2.环境准备4台2层交换机2台三层交换机
3.根据拓扑图配置多生成树,“让SW1成为VLAN10,20的主根,VLAN30,40的次根 ”“让SW2成为VLAN30,40的主根,VLAN10,20的次根 ” 其余的链路作为备份
4.配置命令:
SW1:
[SW1]vlan batch 10 20 30 40 创建VLAN
[SW1]port-group 1 进入组
[SW1-port-group-1]group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/5 进入连续端口,或去掉 to 分别进入1和5端口口
[SW1-port-group-1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/2]port link-type trunk
[SW1-GigabitEthernet0/0/3]port link-type trunk
[SW1-GigabitEthernet0/0/4]port link-type trunk
[SW1-GigabitEthernet0/0/5]port link-type trunk
[SW1-port-group-1]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/5]port trunk allow-pass vlan all
[SW1]stp region-configuration 进入stp配置
[SW1-mst-region]region-name heihei 名字
[SW1-mst-region]instance 1 vlan 10 20 创建树1
[SW1-mst-region]instance 2 vlan 30 40 创建树2
[SW1-mst-region]active region-configuration 激活
[SW1]stp instance 1 root primary 主
[SW1]stp instance 2 root secondary 次
SW2:
[SW2]vlan batch 10 20 30 40
[SW2]port-group 1
[SW2-port-group-1]group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/5
[SW2-port-group-1]port link-type trunk
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/2]port link-type trunk
[SW2-GigabitEthernet0/0/3]port link-type trunk
[SW2-GigabitEthernet0/0/4]port link-type trunk
[SW2-GigabitEthernet0/0/5]port link-type trunk
[SW2-port-group-1]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/5]port trunk allow-pass vlan all
[SW2]stp region-configuration
[SW2-mst-region]region-name heihei
[SW2-mst-region]instance 1 vlan 10 20
[SW2-mst-region]instance 2 vlan 30 40
[SW2-mst-region]active region-configuration
[SW2]stp instance 1 root secondary
[SW2]stp instance 2 root primary
SW3:
[SW3]vlan batch 10 20 30 40
[SW3-port-group-1]group-member Ethernet 0/0/1 Ethernet 0/0/2
[SW3-port-group-1]port link-type trunk
[SW3-Ethernet0/0/1]port link-type trunk
[SW3-Ethernet0/0/2]port link-type trunk
[SW3-port-group-1]port trunk allow-pass vlan all
[SW3-Ethernet0/0/1]port trunk allow-pass vlan all
[SW3-Ethernet0/0/2]port trunk allow-pass vlan all
[SW3]stp region-configuration
[SW3-mst-region]region-name heihei
[SW3-mst-region]instance 1 vlan 10 20
[SW3-mst-region]instance 2 vlan 30 40
[SW3-mst-region]active region-configuration
SW4:
[SW4]port-group 1
[SW4-port-group-1]group-member Ethernet 0/0/1 Ethernet 0/0/2
[SW-port-group-1]port link-type trunk
[SW-Ethernet0/0/1]port link-type trunk
[SW-Ethernet0/0/2]port link-type trunk
[SW-port-group-1]port trunk allow-pass vlan all
[SW4-Ethernet0/0/1]port trunk allow-pass vlan all
[SW4-Ethernet0/0/2]port trunk allow-pass vlan all
[SW4]vlan batch 10 20 30 40
[SW4]stp region-configuration 进入
[SW4-mst-region]region-name heihei
[SW4-mst-region]instance 1 vlan 10 20
[SW4-mst-region]instance 2 vlan 30 40
[SW4-mst-region]active region-configuration
SW5:
[SW5]port-group 1
[SW5-port-group-1]group-member Ethernet 0/0/1 e0/0/2
[SW5-port-group-1]port link-type trunk
[SW5-Ethernet0/0/1]port link-type trunk
[SW5-Ethernet0/0/2]port link-type trunk
[SW5-port-group-1]port trunk allow-pass vlan all
[SW5-Ethernet0/0/1]port trunk allow-pass vlan all
[SW5-Ethernet0/0/2]port trunk allow-pass vlan all
[SW5]vlan batch 10 20 30 40
[SW5]stp region-configuration
[SW5-mst-region]region-name heihei
[SW5-mst-region]instance 1 vlan 10 20
[SW5-mst-region]instance 2 vlan 30 40
[SW5-mst-region]active region-configuration
SW6:
[SW6]port-group 1
[SW6-port-group-1]group-member e0/0/1 e0/0/2
[SW6-port-group-1]port link-type trunk
[SW6-Ethernet0/0/1]port link-type trunk
[SW6-Ethernet0/0/2]port link-type trunk
[SW6-port-group-1]port trunk allow-pass vlan all
[SW6-Ethernet0/0/1]port trunk allow-pass vlan all
[SW6-Ethernet0/0/2]port trunk allow-pass vlan all
[SW6]vlan batch 10 20 30 40
[SW6]stp region-configuration
[SW6-mst-region]region-name heihei
[SW6-mst-region]instance 1 vlan 10 20
[SW6-mst-region]instance 2 vlan 30 40
[SW6-mst-region]active region-configuration
验证:
结果:SW1是VLAN10和20的主根,VLAN30和40的次根,可以看出“树2”的1端口有个ROOT,指的是根的方向,
结果:SW2是VLAN30和40的主根,VLAN10和20的次根,可以看出“树1”的1端口有个ROOT,指的是根的方向,
下面查看一下的4个2层交换机的端口状态:
结果:可以看出SW3上面的树1的1端口指向根(ROOT),树1的2端口是阻塞状态(ALTE);树2的2端口指向根(ROOT),树2的1端口是阻塞状态(ALTE)
可以看出SW4上面的树1的1端口指向根(ROOT),树1的2端口是阻塞状态(ALTE);树2的2端口指向根(ROOT),树2的1端口是阻塞状态(ALTE)
可以看出SW5上面的树1的1端口指向根(ROOT),树1的2端口是阻塞状态(ALTE);树2的2端口指向根(ROOT),树2的1端口是阻塞状态(ALTE)
可以看出SW6上面的树1的1端口指向根(ROOT),树1的2端口是阻塞状态(ALTE);树2的2端口指向根(ROOT),树2的1端口是阻塞状态(ALTE)
原文地址:http://blog.51cto.com/13562456/2068434