拓扑图
- LSW1配置为vlan10的根交换机;LSW2配置为vlan20的根交换机
- PC主机配置如图所示,这里不展示
- 本次核心是配置MSTP多生成树协议
LSW1配置vlan
vlan batch 10 20
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
LSW2配置vlan
vlan batch 10 20
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
LSW3配置vlan
vlan batch 10 20
#
interface Ethernet0/0/1
port link-type access
port default vlan 10
#
interface Ethernet0/0/2
port link-type access
port default vlan 20
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
下面开始配置MSTP
LSW1配置MSTP,设置该交换机为vlan10的根交换机、vlan20的备根交换机
[LSW1]stp mode mstp # 设置交换机stp模式为MSTP
[LSW1]stp region-configuration # 进入MSTP区域配置模式
[LSW1-mst-region]region-name re-mstp # 配置域名为rs-mstp(名字随便)
[LSW1-mst-region]revision-level 1 # 配置版本级别为1
[LSW1-mst-region]instance 1 vlan 10 # 将vlan10加入实例1中
[LSW1-mst-region]instance 2 vlan 20 # 将vlan20加入实例2中
[LSW1-mst-region]active region-configuration # 激活配置(必须激活)
[LSW1-mst-region]quit
[LSW1]stp instance 1 root primary # 配置此交换机为实例1的根交换机
[LSW1]stp instance 2 root secondary # 配置此交换机为实例2的备根交换机
LSW2配置MSTP,设置该交换机为vlan20的根交换机、vlan10的备根交换机
[LSW2]stp mode mstp
[LSW2]stp region-configuration
[LSW2-mst-region]region-name re-mstp
[LSW2-mst-region]revision-level 1
[LSW2-mst-region]instance 1 vlan 10
[LSW2-mst-region]instance 2 vlan 20
[LSW2-mst-region]active region-configuration
[LSW2-mst-region]quit
[LSW2]stp instance 1 root secondary # 设置此交换机为实例1的备根交换机
[LSW2]stp instance 2 root primary # 设置此交换机为实例2的根交换机
LSW3配置MSTP,此交换机必须要设置根或备根
[LSW3]stp mode mstp
[LSW3]stp region-configuration
[LSW3-mst-region]region-name re-mstp
[LSW3-mst-region]revision-level 1
[LSW3-mst-region]instance 1 vlan 10
[LSW3-mst-region]instance 2 vlan 20
[LSW3-mst-region]active region-configuration
[LSW3-mst-region]quit
至此多生成树协议MSTP配置完成,下面在LSW3上查看实例详情信息