实验拓扑图:
1.创建vlan ,配置 trunk
[sw1]vlan b 2 3
[sw1]int g0/0/01
[sw1-GigabitEthernet0/0/1]port l t
[sw1-GigabitEthernet0/0/1]port t a v a
[sw1]int g0/0/2
[sw1-GigabitEthernet0/0/2]por l t
[sw1-GigabitEthernet0/0/2]po t a v a
//配置vlan 2 地址
[sw1]int vl 2
[sw1-Vlanif2] ip address 12.2.2.1 255.255.255.0
[sw2]vlan b 2 3
[sw2]int g0/0/1
[sw2-GigabitEthernet0/0/1]po l t
[sw2-GigabitEthernet0/0/1]po t a v a
[sw2-GigabitEthernet0/0/1]int g0/0/2
[sw2-GigabitEthernet0/0/2]po l t
[sw2-GigabitEthernet0/0/2]po t a v a
[sw2]int vl 2
[sw2-Vlanif2] ip address 13.3.3.1 255.255.255.0
[sw3]vlan b 2 3
[sw3]int g0/0/2
[sw3-GigabitEthernet0/0/2]po l t
[sw3-GigabitEthernet0/0/2]po t a v a
[sw3-GigabitEthernet0/0/2]int g0/0/3
[sw3-GigabitEthernet0/0/3]po l t
[sw3-GigabitEthernet0/0/3]po t a v a
//配置接入层接口划分进vlan
[sw3]int g0/0/4
[sw3-GigabitEthernet0/0/4]por l a
[sw3-GigabitEthernet0/0/4]port d v 2
[sw3-GigabitEthernet0/0/5]por l a
[sw3-GigabitEthernet0/0/5]port d v 3
2.配置MSTP
[sw1]stp en //开启stp
[sw1]stp mod mstp //修改stp模式为mstp
[sw1]stp region-configuration //区域配置
[sw1-mst-region]region-name mstp_vlan2
[sw1-mst-region]revision-level 1
[sw1-mst-region]instance 1 vlan 2 //配置实例
[sw1-mst-region]instance 2 vlan 3
[sw1-mst-region]active region-configuration //激活区域配置
[sw2]stp enable
[sw2]stp mo mstp
[sw2]stp region-configuration
[sw2-mst-region]region-name mstp_vlan2
[sw2-mst-region]revision-level 1
[sw2-mst-region]instance 1 vlan 2
[sw2-mst-region]instance 2 vlan 3
[sw2-mst-region]act region-configuration
[sw3]stp en
[sw3]stp mo mst
[sw3]stp region-configuration
[sw3-mst-region]region-name mstp_vlan2
[sw3-mst-region]revision-level 1
[sw3-mst-region]instance 1 vlan 2
[sw3-mst-region]instance 2 vlan 3
[sw3-mst-region]active region-configuration
3.配置主备根
[sw1]stp instance 1 root primary //对于关联列表中vlan 2 设置 sw1 为root
[sw1]stp instance 2 root secondary
[sw2]stp instance 2 root primary
[sw2]stp instance 1 root secondary
4. 开启边缘端口(接入层设置连接pc接口,将接口排除在外不让参与生成树 计算)
[sw3]int g0/0/4
[sw3-Ethernet0/0/4]stp edged-port enable
[sw3-Ethernet0/0/4]int g 0/0/05
[sw3-Ethernet0/0/5]stp edged-port enable
[sw1-mst-region]dis stp region-configuration //查看实例
[sw1]dis stp instan 1 b 查看实例1 stp接口状态(接口都为DP 即root)
扩展
配置 ETH-Trunk
一台交换机将这多个接口捆绑,形成一个Eth-Trunk接口,从而实现了增加带宽和提高可靠性的目的。
ETH-trunk 配置
清楚 e/0/0/1 接口下的配置
>clear conf int e/0/1
[sw1]int Eth-Trunk 1
[sw1-Eth-Trunk1]int e0/0/01
[sw1-Ethernet0/0/1]eth-trunk 1 //接口加入Eth-Trunk 1
[sw1-Ethernet0/0/1]int e 0/0/05
[sw1-Ethernet0/0/5]eth-trunk 1
[sw2]int Eth-Trunk 1
[sw2-Eth-Trunk1]int e0/0/01
[sw2-Ethernet0/0/1]eth-trunk 1
[sw2-Ethernet0/0/1]int e 0/0/05
[sw2-Ethernet0/0/5]eth-trunk 1
[sw2-Ethernet0/0/5]dis int brief //查看接口状态
[sw2-Ethernet0/0/5]int eth-t 1
[sw2-Eth-Trunk1]p l t
[sw2-Eth-Trunk1]p t a v a
[sw1-Ethernet0/0/5]in eth-t 1
[sw1-Eth-Trunk1]p l t
[sw1-Eth-Trunk1]p t a v a