- 组网需求
• 网络中所有设备都属于同一个 MST 域。Device A 和Device B 为汇聚层设备,Device C 和Device D 为接入层设备。
• 通过配置 MSTP,使不同VLAN 的报文按照不同的MSTI 转发:VLAN 10 的报文沿MSTI 1转发,VLAN 30 沿MSTI 3 转发,VLAN 40 沿MSTI 4 转发,VLAN 20 沿MSTI 0 转发。
• 由于 VLAN 10 和VLAN 30 在汇聚层设备终结、VLAN 40 在接入层设备终结,因此配置MSTI1 和MSTI 3 的根桥分别为Device A 和Device B,MSTI 4 的根桥为Device C。
2 .组网图
3 配置步骤
1 配置 VLAN 和端口
请按照图1-12在Device A和Device B上分别创建VLAN 10、20和30,在Device C上创建VLAN 10、
20 和 40,在Device D上创建VLAN 20、30 和 40;将各设备的各端口配置为Trunk端口并允许相应
的VLAN通过,具体配置:
DeviceA
sys
vlan 10
vlan 20
vlan 30
inter g 1/0/1
port link-type trunk
port trunk permit vlan 10 20
quit
inter g 1/0/2
port link-type trunk
port trunk permit vlan 20 30
quit
inter g 1/0/3
port link-type trunk
port trunk permit vlan all
quit
DeviceB
sys
vlan 10
vlan 20
vlan 30
inter g 1/0/1
port link-type trunk
port trunk permit vlan 20 30
quit
inter g 1/0/2
port link-type trunk
port trunk permit vlan 10 20
quit
inter g 1/0/3
port link-type trunk
port trunk permit vlan all
quit
DeviceC
sys
vlan 10
vlan 20
vlan 40
inter g 1/0/1
port link-type trunk
port trunk permit vlan 10 20
quit
inter g 1/0/2
port link-type trunk
port trunk permit vlan 10 20
quit
inter g 1/0/3
port link-type trunk
port trunk permit vlan 20 40
quit
DeviceD
sys
vlan 20
vlan 30
vlan 40
inter g 1/0/1
port link-type trunk
port trunk permit vlan 20 30
quit
inter g 1/0/2
port link-type trunk
port trunk permit vlan 20 30
quit
inter g 1/0/3
port link-type trunk
port trunk permit vlan 20 40
quit
2 配置 Device A
配置 MST 域的域名为 example,将 VLAN 10、30、40 分别映射到 MSTI 1、3、4 上,并配置MSTP 的修订级别为 0。
[DeviceA] stp region-configuration
[DeviceA-mst-region] region-name example
[DeviceA-mst-region] instance 1 vlan 10
[DeviceA-mst-region] instance 3 vlan 30
[DeviceA-mst-region] instance 4 vlan 40
[DeviceA-mst-region] revision-level 0
#激活MST域的配置
[DeviceA-mst-region] active region-configuration
[DeviceA-mst-region] quit
#配置本设备为 MSTI 1 的根桥。
[DeviceA] stp instance 1 root primary
全局使能生成树协议。
[DeviceA] stp global enable
3 配置 Device B
配置 MST 域的域名为 example,将 VLAN 10、30、40
分别映射到 MSTI 1、3、4 上,并配置MSTP 的修订级别为 0。
[DeviceB] stp region-configuration
[DeviceB-mst-region] region-name example
[DeviceB-mst-region] instance 1 vlan 10
[DeviceB-mst-region] instance 3 vlan 30
[DeviceB-mst-region] instance 4 vlan 40
[DeviceB-mst-region] revision-level 0
激活 MST 域的配置。
[DeviceB-mst-region] active region-configuration
[DeviceB-mst-region] quit
配置本设备为 MSTI 3 的根桥。
[DeviceB] stp instance 3 root primary
#全局使能生成树协议。
[DeviceB] stp global enable
4 配置 Device C
#配置 MST 域的域名为 example,将 VLAN 10、30、40
分别映射到 MSTI 1、3、4 上,并配置MSTP 的修订级别为 0。
[DeviceC] stp region-configuration
[DeviceC-mst-region] region-name example
[DeviceC-mst-region] instance 1 vlan 10
[DeviceC-mst-region] instance 3 vlan 30
[DeviceC-mst-region] instance 4 vlan 40
[DeviceC-mst-region] revision-level 0
#激活 MST 域的配置。
[DeviceC-mst-region] active region-configuration
[DeviceC-mst-region] quit
#配置本设备为 MSTI 4 的根桥。
[DeviceC] stp instance 4 root primary
#全局使能生成树协议。
[DeviceC] stp global enable
5 配置 Device D
#配置 MST 域的域名为 example,将 VLAN 10、30、40
分别映射到 MSTI 1、3、4 上,并配置
MSTP 的修订级别为 0。
[DeviceD] stp region-configuration
[DeviceD-mst-region] region-name example
[DeviceD-mst-region] instance 1 vlan 10
[DeviceD-mst-region] instance 3 vlan 30
[DeviceD-mst-region] instance 4 vlan 40
[DeviceD-mst-region] revision-level 0
#激活 MST 域的配置。
[DeviceD-mst-region] active region-configuration
[DeviceD-mst-region] quit
#全局使能生成树协议。
[DeviceD] stp global enable
6 验证配置
当网络拓扑稳定后,通过使用 display stp brief 命令可以查看各设备上生成树的简要信息。
具体情况根据虚拟设备MAC地址可能有不同。
[DeviceA]dis stp brief
MST ID Port Role STP State Protection
0 GigabitEthernet1/0/1 DESI FORWARDING NONE
0 GigabitEthernet1/0/2 DESI FORWARDING NONE
0 GigabitEthernet1/0/3 DESI FORWARDING NONE
1 GigabitEthernet1/0/1 DESI FORWARDING NONE
1 GigabitEthernet1/0/3 DESI FORWARDING NONE
3 GigabitEthernet1/0/1 DESI DISCARDING NONE
3 GigabitEthernet1/0/2 DESI FORWARDING NONE
3 GigabitEthernet1/0/3 ROOT FORWARDING NONE
[DeviceB]dis stp brief
MST ID Port Role STP State Protection
0 GigabitEthernet1/0/1 DESI FORWARDING NONE
0 GigabitEthernet1/0/2 DESI FORWARDING NONE
0 GigabitEthernet1/0/3 ROOT FORWARDING NONE
1 GigabitEthernet1/0/2 DESI FORWARDING NONE
1 GigabitEthernet1/0/3 ROOT FORWARDING NONE
3 GigabitEthernet1/0/1 DESI FORWARDING NONE
3 GigabitEthernet1/0/3 DESI FORWARDING NONE
[DeviceC]dis stp brief
MST ID Port Role STP State Protection
0 GigabitEthernet1/0/1 ROOT FORWARDING NONE
0 GigabitEthernet1/0/2 ALTE DISCARDING NONE
0 GigabitEthernet1/0/3 DESI FORWARDING NONE
1 GigabitEthernet1/0/1 ROOT FORWARDING NONE
1 GigabitEthernet1/0/2 ALTE DISCARDING NONE
4 GigabitEthernet1/0/3 DESI FORWARDING NONE
[DeviceD]dis stp brief
MST ID Port Role STP State Protection
0 GigabitEthernet1/0/1 ALTE DISCARDING NONE
0 GigabitEthernet1/0/2 ROOT FORWARDING NONE
0 GigabitEthernet1/0/3 ALTE DISCARDING NONE
3 GigabitEthernet1/0/1 ROOT FORWARDING NONE
3 GigabitEthernet1/0/2 ALTE DISCARDING NONE
4 GigabitEthernet1/0/3 ROOT FORWARDING NONE