08-生成树典型配置举例
本章节下载: 08-生成树典型配置举例 (412.43 KB)
资料版本:6W100-20190628
Copyright © 2019 新华三技术有限公司 版权所有,保留一切权利。
非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部,并不得以任何形式传播。
除新华三技术有限公司的商标外,本手册中出现的其它公司的商标、产品标识及商品名称,由各自权利人拥有。
本文档中的信息可能变动,恕不另行通知。
目 录
本文档介绍了生成树的配置举例。
本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。
本文假设您已了解生成树特性。
如图1所示:
· 网络中所有设备都属于同一个MST域,设备的端口均允许VLAN 11~30通过。
· Device A和Device B为核心层设备,Device C和Device D为汇聚层设备。
· 假定所有端口路径开销相同。
要求通过配置MSTP功能,实现:
· 网络中无二层环路。
· Device C和Device D的VLAN 11~20报文、VLAN 21~30报文沿不同链路分别上行到Device A和Device B,实现流量负载分担和链路备份。
图1 MSTP配置组网图
· 要使所有设备属于同一MST域,在所有设备上配置相同的如下参数:
¡ 生成树的工作模式(缺省为MSTP模式,无需配置)
¡ 域名(本例配置为test)
¡ 修订级别(缺省为0,无需配置)
¡ VLAN映射表(本例将VLAN 11~20映射到MSTI 1,VLAN 21~30映射到MSTI 2)
· 为了使MSTI 1和MSTI 2拓扑中的上行链路不同并互相作为冗余备份,配置Device A为MSTI 1的根桥,Device B为MSTI 2的根桥。另外,本例中配置Device A、B、C、D在MSTI 0的优先级依次降低,使Device A成为IST域根。形成的多个生成树实例拓扑如图2所示。
图2 各VLAN对应的生成树实例的拓扑
本举例是在S6890-CMW710-R2712版本上进行配置和验证的。
缺省情况下,S6890系列交换机的接口处于ADM(Administratively Down)状态,请根据实际需要在对应接口视图下使用undo shutdown命令开启接口。
# 创建VLAN 11~30。将设备的各端口配置为Trunk端口并允许VLAN 11~30通过。
<DeviceA> system-view
[DeviceA] vlan 11 to 30
[DeviceA] interface range ten-gigabitethernet 1/0/1 to ten-gigabitethernet 1/0/3
[DeviceA-if-range] port link-type trunk
[DeviceA-if-range] port trunk permit vlan 11 to 30
[DeviceA-if-range] quit
# 配置MST域的域名为test,将VLAN 11~20映射到MSTI 1,VLAN 21~30映射到MSTI 2。
[DeviceA] stp region-configuration
[DeviceA-mst-region] region-name test
[DeviceA-mst-region] instance 1 vlan 11 to 20
[DeviceA-mst-region] instance 2 vlan 21 to 30
[DeviceA-mst-region] active region-configuration
[DeviceA-mst-region] quit
# 配置本设备为MSTI 0和1的根桥。
[DeviceA] stp instance 0 to 1 root primary
# 全局使能生成树协议。
[DeviceA] stp global enable
# 创建VLAN 11~30。将设备的各端口配置为Trunk端口并允许VLAN 11~30通过。
<DeviceB> system-view
[DeviceB] vlan 11 to 30
[DeviceB] interface range ten-gigabitethernet 1/0/1 to ten-gigabitethernet 1/0/3
[DeviceB-if-range] port link-type trunk
[DeviceB-if-range] port trunk permit vlan 11 to 30
[DeviceB-if-range] quit
# 配置MST域的域名为test,将VLAN 11~20映射到MSTI 1,VLAN 21~30映射到MSTI 2。
[DeviceB] stp region-configuration
[DeviceB-mst-region] region-name test
[DeviceB-mst-region] instance 1 vlan 11 to 20
[DeviceB-mst-region] instance 2 vlan 21 to 30
[DeviceB-mst-region] active region-configuration
[DeviceB-mst-region] quit
# 配置本设备为MSTI 2的根桥,以及MSTI 0的备份根桥。
[DeviceB] stp instance 2 root primary
[DeviceB] stp instance 0 root secondary
# 全局使能生成树协议。
[DeviceB] stp global enable
# 创建VLAN 11~30。将设备的各端口配置为Trunk端口并允许VLAN 11~30通过。
<DeviceC> system-view
[DeviceC] vlan 11 to 30
[DeviceC] interface range ten-gigabitethernet 1/0/1 to ten-gigabitethernet 1/0/2
[DeviceC-if-range] port link-type trunk
[DeviceC-if-range] port trunk permit vlan 11 to 30
[DeviceC-if-range] quit
# 配置MST域的域名为test,将VLAN 11~20映射到MSTI 1,VLAN 21~30映射到MSTI 2。
[DeviceC] stp region-configuration
[DeviceC-mst-region] region-name test
[DeviceC-mst-region] instance 1 vlan 11 to 20
[DeviceC-mst-region] instance 2 vlan 21 to 30
[DeviceC-mst-region] active region-configuration
[DeviceC-mst-region] quit
# 全局使能生成树协议。
[DeviceC] stp global enable
# 创建VLAN 11~30。将设备的各端口配置为Trunk端口并允许VLAN 11~30通过。
<DeviceD> system-view
[DeviceD] vlan 11 to 30
[DeviceD] interface range ten-gigabitethernet 1/0/1 to ten-gigabitethernet 1/0/2
[DeviceD-if-range] port link-type trunk
[DeviceD-if-range] port trunk permit vlan 11 to 30
[DeviceD-if-range] quit
# 配置MST域的域名为test,将VLAN 11~20映射到MSTI 1,VLAN 21~30映射到MSTI 2。
[DeviceD] stp region-configuration
[DeviceD-mst-region] region-name test
[DeviceD-mst-region] instance 1 vlan 11 to 20
[DeviceD-mst-region] instance 2 vlan 21 to 30
[DeviceD-mst-region] active region-configuration
[DeviceD-mst-region] quit
# 配置本设备在MSTI 0的优先级为36864,从而使本设备在MSTI 0的优先级低于Device C(Device C使用缺省优先级32768)。
[DeviceD] stp instance 0 priority 36864
# 全局使能生成树协议。
[DeviceD] stp global enable
(1) 查看生成树实例拓扑信息
# 查看Device A上生成树的简要信息。
[DeviceA] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/3 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/3 DESI FORWARDING NONE
2 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
2 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
2 Ten-GigabitEthernet1/0/3 ROOT FORWARDING NONE
# 查看Device B上生成树的简要信息。
[DeviceB] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/3 ROOT FORWARDING NONE
1 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/3 ROOT FORWARDING NONE
2 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
2 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
2 Ten-GigabitEthernet1/0/3 DESI FORWARDING NONE
# 查看Device C上生成树的简要信息。
[DeviceC] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 ROOT FORWARDING NONE
0 Ten-GigabitEthernet1/0/2 ALTE DISCARDING NONE
1 Ten-GigabitEthernet1/0/1 ROOT FORWARDING NONE
1 Ten-GigabitEthernet1/0/2 ALTE DISCARDING NONE
2 Ten-GigabitEthernet1/0/1 ALTE DISCARDING NONE
2 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
# 查看Device D上生成树的简要信息。
[DeviceD] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 ALTE DISCARDING NONE
0 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
1 Ten-GigabitEthernet1/0/1 ALTE DISCARDING NONE
1 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
2 Ten-GigabitEthernet1/0/1 ROOT FORWARDING NONE
2 Ten-GigabitEthernet1/0/2 ALTE DISCARDING NONE
根据上述显示信息中的Alternate端口(阻塞端口),可以绘出各VLAN所对应MSTI的拓扑,如图3所示。
图3 MSTI 0~2的拓扑
可以看到,Device C和Device D的VLAN 11~20报文和VLAN 21~30报文沿不同的上行链路转发;网络中无二层环路。
(2) 验证链路备份功能
关闭Device C的端口XGE1/0/1(这是Device C在MSTI 0~1中的上行链路所在端口)。然后查看Device A、B、C、D上生成树的简要信息。
[DeviceA] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/3 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/3 DESI FORWARDING NONE
2 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
2 Ten-GigabitEthernet1/0/3 ROOT FORWARDING NONE
[DeviceB] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/3 ROOT FORWARDING NONE
1 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/3 ROOT FORWARDING NONE
2 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
2 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
2 Ten-GigabitEthernet1/0/3 DESI FORWARDING NONE
[DeviceC] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
1 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
2 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
[DeviceD] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 ALTE DISCARDING NONE
0 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
1 Ten-GigabitEthernet1/0/1 ALTE DISCARDING NONE
1 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
2 Ten-GigabitEthernet1/0/1 ROOT FORWARDING NONE
2 Ten-GigabitEthernet1/0/2 ALTE DISCARDING NONE
根据上述显示信息中的Alternate端口(阻塞端口),可以绘出各VLAN所对应MSTI的拓扑,如图4所示。
图4 某链路断开后MSTI 0~2的拓扑
可以看到,Device C在MSTI 0~1中的上行链路所在端口已从原先的XGE1/0/1切换为XGE1/0/2。
· Device A
#
vlan 1
#
vlan 11 to 30
#
stp region-configuration
region-name test
instance 1 vlan 11 to 20
instance 2 vlan 21 to 30
active region-configuration
#
stp instance 0 to 1 root primary
stp global enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 11 to 30
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 11 to 30
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 11 to 30
#
· Device B
#
vlan 1
#
vlan 11 to 30
#
stp region-configuration
region-name test
instance 1 vlan 11 to 20
instance 2 vlan 21 to 30
active region-configuration
#
stp instance 0 root secondary
stp instance 2 root primary
stp global enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 11 to 30
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 11 to 30
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 11 to 30
#
· Device C
#
vlan 1
#
vlan 11 to 30
#
stp region-configuration
region-name test
instance 1 vlan 11 to 20
instance 2 vlan 21 to 30
active region-configuration
#
stp global enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 11 to 30
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 11 to 30
#
· Device D
#
vlan 1
#
vlan 11 to 30
#
stp region-configuration
region-name test
instance 1 vlan 11 to 20
instance 2 vlan 21 to 30
active region-configuration
#
stp instance 0 priority 36864
stp global enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 11 to 30
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 11 to 30
#
如图5所示:
· Device A和Device B为汇聚层设备,Device C和Device D为接入层设备。
· 假定所有设备的端口路径开销相同。
要求通过配置PVST功能,实现:
· 网络中无二层环路,冗余链路对流量进行负载分担。
· VLAN 10、20、30中的报文分别按照其VLAN所对应的生成树转发。
图5 PVST配置组网图
欲实现按每个VLAN阻塞冗余链路,并使冗余链路承载其他VLAN的流量,需要使不同VLAN所对应生成树的拓扑不同,来增加冗余链路的利用率。本例配置Device A为VLAN 10和30对应生成树的根桥,Device B为VLAN 20对应生成树的根桥。
当设备在指定VLAN中被配置为根桥时,其优先级强制变为0;由于各端口路径开销相同,根据STP算法可以得到各VLAN所对应生成树的拓扑,如图6所示。
图6 各VLAN所对应生成树的拓扑图
本举例是在S6890-CMW710-R2712版本上进行配置和验证的。
缺省情况下,S6890系列交换机的接口处于ADM(Administratively Down)状态,请根据实际需要在对应接口视图下使用undo shutdown命令开启接口。
# 创建VLAN 10、20和30。将设备的各端口配置为Trunk端口并允许相应VLAN通过。
<DeviceA> system-view
[DeviceA] vlan 10
[DeviceA-vlan10] vlan 20
[DeviceA-vlan20] vlan 30
[DeviceA-vlan30] quit
[DeviceA] interface ten-gigabitethernet 1/0/1
[DeviceA-Ten-GigabitEthernet1/0/1] port link-type trunk
[DeviceA-Ten-GigabitEthernet1/0/1] port trunk permit vlan 10 20
[DeviceA-Ten-GigabitEthernet1/0/1] quit
[DeviceA] interface ten-gigabitethernet 1/0/2
[DeviceA-Ten-GigabitEthernet1/0/2] port link-type trunk
[DeviceA-Ten-GigabitEthernet1/0/2] port trunk permit vlan 20 30
[DeviceA-Ten-GigabitEthernet1/0/2] quit
[DeviceA] interface ten-gigabitethernet 1/0/3
[DeviceA-Ten-GigabitEthernet1/0/3] port link-type trunk
[DeviceA-Ten-GigabitEthernet1/0/3] port trunk permit vlan 10 20 30
[DeviceA-Ten-GigabitEthernet1/0/3] quit
# 配置生成树的工作模式为PVST模式。
[DeviceA] stp mode pvst
# 配置本设备为VLAN 10和30的根桥。
[DeviceA] stp vlan 10 30 root primary
# 全局使能生成树协议。
[DeviceA] stp global enable
# 创建VLAN 10、20和30。将设备的各端口配置为Trunk端口并允许相应VLAN通过。
<DeviceB> system-view
[DeviceB] vlan 10
[DeviceB-vlan10] vlan 20
[DeviceB-vlan20] vlan 30
[DeviceB-vlan30] quit
[DeviceB] interface ten-gigabitethernet 1/0/1
[DeviceB-Ten-GigabitEthernet1/0/1] port link-type trunk
[DeviceB-Ten-GigabitEthernet1/0/1] port trunk permit vlan 20 30
[DeviceB-Ten-GigabitEthernet1/0/1] quit
[DeviceB] interface ten-gigabitethernet 1/0/2
[DeviceB-Ten-GigabitEthernet1/0/2] port link-type trunk
[DeviceB-Ten-GigabitEthernet1/0/2] port trunk permit vlan 10 20
[DeviceB-Ten-GigabitEthernet1/0/2] quit
[DeviceB] interface ten-gigabitethernet 1/0/3
[DeviceB-Ten-GigabitEthernet1/0/3] port link-type trunk
[DeviceB-Ten-GigabitEthernet1/0/3] port trunk permit vlan 10 20 30
[DeviceB-Ten-GigabitEthernet1/0/3] quit
# 配置生成树的工作模式为PVST模式。
[DeviceB] stp mode pvst
# 配置本设备为VLAN 20的根桥。
[DeviceB] stp vlan 20 root primary
# 全局使能生成树协议。
[DeviceB] stp global enable
# 创建VLAN 10和20。将设备的各端口配置为Trunk端口并允许相应VLAN通过。
<DeviceC> system-view
[DeviceC] vlan 10
[DeviceC-vlan10] vlan 20
[DeviceC-vlan20] quit
[DeviceC] interface range ten-gigabitethernet 1/0/1 to ten-gigabitethernet 1/0/2
[DeviceC-if-range] port link-type trunk
[DeviceC-if-range] port trunk permit vlan 10 20
[DeviceC-if-range] quit
# 配置生成树的工作模式为PVST模式。
[DeviceC] stp mode pvst
# 全局使能生成树协议。
[DeviceC] stp global enable
# 创建VLAN 20和30。将设备的各端口配置为Trunk端口并允许相应VLAN通过。
<DeviceD> system-view
[DeviceD] vlan 20
[DeviceD-vlan20] vlan 30
[DeviceD-vlan30] quit
[DeviceD] interface range ten-gigabitethernet 1/0/1 to ten-gigabitethernet 1/0/2
[DeviceD-if-range] port link-type trunk
[DeviceD-if-range] port trunk permit vlan 20 30
[DeviceD-if-range] quit
# 配置生成树的工作模式为PVST模式。
[DeviceD] stp mode pvst
# 全局使能生成树协议。
[DeviceD] stp global enable
# 查看Device A上生成树的简要信息。
[DeviceA] display stp brief
VLAN ID Port Role STP State Protection
1 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/3 DESI DISCARDING NONE
10 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
10 Ten-GigabitEthernet1/0/3 DESI FORWARDING NONE
20 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
20 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
20 Ten-GigabitEthernet1/0/3 ROOT FORWARDING NONE
30 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
30 Ten-GigabitEthernet1/0/3 DESI FORWARDING NONE
# 查看Device B上生成树的简要信息。
[DeviceB] display stp brief
VLAN ID Port Role STP State Protection
1 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
1 Ten-GigabitEthernet1/0/3 ROOT FORWARDING NONE
10 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
10 Ten-GigabitEthernet1/0/3 ROOT FORWARDING NONE
20 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
20 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
20 Ten-GigabitEthernet1/0/3 DESI FORWARDING NONE
30 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
30 Ten-GigabitEthernet1/0/3 ROOT FORWARDING NONE
# 查看Device C上生成树的简要信息。
[DeviceC] display stp brief
VLAN ID Port Role STP State Protection
1 Ten-GigabitEthernet1/0/1 ROOT FORWARDING NONE
1 Ten-GigabitEthernet1/0/2 ALTE DISCARDING NONE
10 Ten-GigabitEthernet1/0/1 ROOT FORWARDING NONE
10 Ten-GigabitEthernet1/0/2 ALTE DISCARDING NONE
20 Ten-GigabitEthernet1/0/1 ALTE DISCARDING NONE
20 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
# 查看Device D上生成树的简要信息。
[DeviceD] display stp brief
VLAN ID Port Role STP State Protection
1 Ten-GigabitEthernet1/0/1 ALTE DISCARDING NONE
1 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
20 Ten-GigabitEthernet1/0/1 ROOT FORWARDING NONE
20 Ten-GigabitEthernet1/0/2 ALTE DISCARDING NONE
30 Ten-GigabitEthernet1/0/1 ALTE DISCARDING NONE
30 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
根据上述显示信息中VLAN 10、20和30的Alternate端口(阻塞端口),可以绘出各VLAN所对应生成树的拓扑,如图7所示。
图7 VLAN10、20、30所对应生成树的拓扑图
可以看到,PVST通过按VLAN阻塞冗余链路,消除了二层环路;由于各VLAN流量沿不同路径转发,实现了冗余链路的负载分担。
· Device A
#
vlan 1
#
vlan 10
#
vlan 20
#
vlan 30
#
stp vlan 10 30 root primary
stp mode pvst
stp global enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 10 20
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 20 30
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 10 20 30
#
· Device B
#
vlan 1
#
vlan 10
#
vlan 20
#
vlan 30
#
stp vlan 20 root primary
stp mode pvst
stp global enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 20 30
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 10 20
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 10 20 30
#
· Device C
#
vlan 1
#
vlan 10
#
vlan 20
#
stp mode pvst
stp global enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 10 20
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 10 20
#
· Device D
#
vlan 1
#
vlan 20
#
vlan 30
#
stp mode pvst
stp global enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 20 30
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 20 30
#
如图8所示,用户局域网内采用分层组网:
· Device A为核心层设备,Device B、Device C为汇聚层设备,Device D、Device E为接入层设备。
· 假定所有设备的端口路径开销相同。
现要求使用RSTP技术阻断二层环路,实现链路备份。具体应用需求如下:
· 配置Device A为根桥,并保护根桥不被维护人员的错误配置或网络中的恶意攻击影响。
· Device C作为Device B的备份——当Device B出现故障的时候,由Device C转发数据。
· 配置Device D、E与用户直接相连的端口为边缘端口,并使能BPDU保护功能。
图8 RSTP配置组网图
· 要使Device C成为Device B的备份,就给Device B配置较高的桥优先级。本例中配置Device B的优先级为4096,Device C为8192。
· 要使Device A成为根桥,需要使它的桥ID(优先级+MAC地址)在全网最小。本例中Device A的MAC地址小于Device B(如图9所示),配置Device A的优先级为4096就可以使它成为根桥。
要配置一台设备为根桥,也可以用stp root primary或stp priority 0命令将其优先级变为0。
· 为了维持根桥的稳定,在Device A、B、C的指定端口上开启根保护功能。要找到指定端口,可以在完成本例的配置步骤后,在各设备上用display stp brief命令查找角色为DESI的端口;或者根据STP算法预测如图9所示的生成树拓扑和指定端口信息。
图9 RSTP拓扑图
本举例是在S6890-CMW710-R2712版本上进行配置和验证的。
缺省情况下,S6890系列交换机的接口处于ADM(Administratively Down)状态,请根据实际需要在对应接口视图下使用undo shutdown命令开启接口。
# 配置设备工作在RSTP模式。
<DeviceA> system-view
[DeviceA] stp mode rstp
# 配置设备的优先级为4096。
[DeviceA] stp priority 4096
# 全局使能生成树协议。
[DeviceA] stp global enable
# 在与Device B、C相连的指定端口上启动根保护功能。
[DeviceA] interface range ten-gigabitethernet 1/0/1 to ten-gigabitethernet 1/0/2
[DeviceA-if-range] stp root-protection
[DeviceA-if-range] quit
# 配置设备工作在RSTP模式。
<DeviceB> system-view
[DeviceB] stp mode rstp
# 配置设备的优先级为4096。
[DeviceB] stp priority 4096
# 全局使能生成树协议。
[DeviceB] stp global enable
# 在各指定端口上启动根保护功能。
[DeviceB] interface range ten-gigabitethernet 1/0/1 to ten-gigabitethernet 1/0/3
[DeviceB-if-range] stp root-protection
[DeviceB-if-range] quit
# 配置设备工作在RSTP模式。
<DeviceC> system-view
[DeviceC] stp mode rstp
# 配置设备的优先级为8192。
[DeviceC] stp priority 8192
# 全局使能生成树协议。
[DeviceC] stp global enable
# 在各指定端口上启动根保护功能。
[DeviceC] interface range ten-gigabitethernet 1/0/1 to ten-gigabitethernet 1/0/2
[DeviceC-if-range] stp root-protection
[DeviceC-if-range] quit
Device D、E的配置相同,这里以Device D为例。
# 配置设备工作在RSTP模式。
<DeviceD> system-view
[DeviceD] stp mode rstp
# 全局使能生成树协议。
[DeviceD] stp global enable
# 将与用户直接相连的端口配置为边缘端口(此处仅以Ten-GigabitEthernet1/0/4为例),并使能BPDU保护功能。
[DeviceD] interface ten-gigabitethernet 1/0/4
[DeviceD-Ten-GigabitEthernet1/0/4] stp edged-port
[DeviceD-Ten-GigabitEthernet1/0/4] quit
[DeviceD] stp bpdu-protection
(1) 查看生成树实例拓扑信息
# 查看Device A上生成树的简要信息。
[DeviceA] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
# 查看Device B上生成树的简要信息。
[DeviceB] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/3 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/4 ROOT FORWARDING NONE
# 查看Device C上生成树的简要信息。
[DeviceC] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/2 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/3 ALTE DISCARDING NONE
0 Ten-GigabitEthernet1/0/4 ROOT FORWARDING NONE
# 查看Device D上生成树的简要信息。
[DeviceD] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 ROOT FORWARDING NONE
0 Ten-GigabitEthernet1/0/2 ALTE DISCARDING NONE
0 Ten-GigabitEthernet1/0/4 DESI FORWARDING BPDU
# 查看Device E上生成树的简要信息。
[DeviceE] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 ALTE DISCARDING NONE
0 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
0 Ten-GigabitEthernet1/0/4 DESI FORWARDING BPDU
根据上述显示信息(角色为ALTE的是阻塞端口,DESI是指定端口,ROOT是根端口),可以绘出生成树的拓扑,如图10所示。
图10 RSTP拓扑示意图
(2) 验证根桥保护功能
# 初始状态,Device D认为Device A是根桥。
[DeviceD] display stp
-------[CIST Global Info] [Mode RSTP] -------
Bridge ID : 32768.00e0-fc00-c518
Bridge times : Hello 2s MaxAge 20s FwdDelay 15s MaxHops 20
Root ID/ERPC : 4096.0000-fc00-47cd, 40
RegRoot ID/IRPC : 32768.00e0-fc00-c518, 0
...
可以看到,Device D上的根桥ID为Device A的桥ID。
# 出于攻击根桥的目的,将Device D的桥优先级设为0(比合法根桥Device A的优先级更高),使Device D认为自己是根桥,并往外发送根桥ID为0.00e0-fc00-c518的BPDU。
[DeviceD] stp priority 0
[DeviceD] display stp
-------[CIST Global Info] [Mode RSTP] -------
Bridge ID : 0.00e0-fc00-c518
Bridge times : Hello 2s MaxAge 20s FwdDelay 15s MaxHops 20
Root ID/ERPC : 0.00e0-fc00-c518, 0
RegRoot ID/IRPC : 0.00e0-fc00-c518, 0
...
# 将Device E的桥优先级也设为0,使它认为自己是根桥,并往外发送根桥ID为0.7425-8a0f-8000的BPDU。
[DeviceE] stp priority 0
[DeviceE] display stp
-------[CIST Global Info] [Mode RSTP] -------
Bridge ID : 0.7425-8a0f-8000
Bridge times : Hello 2s MaxAge 20s FwdDelay 15s MaxHops 20
Root ID/ERPC : 0.7425-8a0f-8000, 0
RegRoot ID/IRPC : 0.7425-8a0f-8000, 0
...
# 查看Device B、C上的生成树信息。
[DeviceB] display stp
-------[CIST Global Info] [Mode RSTP] -------
Bridge ID : 4096.7425-8a02-4c00
Bridge times : Hello 2s MaxAge 20s FwdDelay 15s MaxHops 20
Root ID/ERPC : 4096.0000-fc00-47cd, 20
RegRoot ID/IRPC : 4096.7425-8a02-4c00, 0
...
[DeviceC] display stp
-------[CIST Global Info] [Mode RSTP] -------
Bridge ID : 8192.0cda-41b1-d1c0
Bridge times : Hello 2s MaxAge 20s FwdDelay 15s MaxHops 20
Root ID/ERPC : 4096.0000-fc00-47cd, 20
RegRoot ID/IRPC : 8192.0cda-41b1-d1c0, 0
...
可以看到Device B、C的根桥ID仍为Device A的桥ID。这是因为Device B、C上与Device D、E相连的指定端口均开启了根保护功能,不受优先级更高的BPDU影响。
# 此时如果把Device B的指定端口(例如连接Device E的Ten-GigabitEthernet1/0/2)去掉根保护功能,则会导致Device B上原有合法根桥Device A失去根桥的地位,引起网络拓扑结构的错误变动。
[DeviceB] interface ten-gigabitethernet 1/0/2
[DeviceB-Ten-GigabitEthernet1/0/2] undo stp root-protection
[DeviceB-Ten-GigabitEthernet1/0/2] display stp
-------[CIST Global Info] [Mode RSTP] -------
Bridge ID : 4096.7425-8a02-4c00
Bridge times : Hello 2s MaxAge 20s FwdDelay 15s MaxHops 20
Root ID/ERPC : 0.7425-8a0f-8000, 20
...
[DeviceB-Ten-GigabitEthernet1/0/2] display stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 DESI DISCARDING ROOT
0 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
0 Ten-GigabitEthernet1/0/3 DESI FORWARDING NONE
0 Ten-GigabitEthernet1/0/4 DESI FORWARDING NONE
(3) 验证链路备份功能
# 假设Device B因故障重启。在Device B恢复正常前,查看Device A、C、D、E上生成树的简要信息。
[DeviceA] dis stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/2 DESI FORWARDING ROOT
[DeviceC] dis stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 DESI FORWARDING ROOT
0 Ten-GigabitEthernet1/0/2 DESI FORWARDING ROOT
0 Ten-GigabitEthernet1/0/4 ROOT FORWARDING NONE
[DeviceD] dis stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/2 ROOT FORWARDING NONE
0 Ten-GigabitEthernet1/0/4 DESI FORWARDING BPDU
[DeviceE] dis stp brief
MST ID Port Role STP State Protection
0 Ten-GigabitEthernet1/0/1 ROOT FORWARDING NONE
0 Ten-GigabitEthernet1/0/4 DESI FORWARDING BPDU
可见Device D、E上原先阻塞的端口变为根端口并进入转发状态。
根据上述显示信息可以绘出生成树的拓扑,如图11所示。可见Device B故障的时候由Device C转发数据。
(4) 验证BPDU保护功能
# 以Device D上的边缘端口XGE1/0/4为例,当它收到BPDU报文时,端口自动进入down状态,以保护生成树拓扑不受外来BPDU影响。可通过以下命令查看被生成树保护功能down掉的端口信息。
[DeviceD] display stp down-port
Down Port Reason
Ten-GigabitEthernet1/0/4 BPDU-Protected
# 当对端不再发送BPDU报文时,边缘端口XGE1/0/4恢复Up状态。
[DeviceD] display interface brief | include UP
InLoop0 UP UP(s) --
M-E0/0/0 UP UP 192.168.2.125
NULL0 UP UP(s) --
XGE1/0/1 UP 1G(a) F(a) T 1
XGE1/0/2 UP 1G(a) F(a) T 1
XGE1/0/4 UP 1G(a) F(a) A 1
· Device A
#
vlan 1
#
stp instance 0 priority 4096
stp mode rstp
stp global enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
stp root-protection
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
stp root-protection
#
· Device B
#
vlan 1
#
stp instance 0 priority 4096
stp mode rstp
stp global enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
stp root-protection
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
stp root-protection
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
stp root-protection
#
interface Ten-GigabitEthernet1/0/4
port link-mode bridge
#
· Device C
#
vlan 1
#
stp instance 0 priority 8192
stp mode rstp
stp global enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
stp root-protection
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
stp root-protection
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
#
interface Ten-GigabitEthernet1/0/4
port link-mode bridge
#
· Device D、E
#
vlan 1
#
stp mode rstp
stp bpdu-protection
stp global enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
#
interface Ten-GigabitEthernet1/0/4
port link-mode bridge
stp edged-port
#
· H3C S6890系列以太网交换机 二层技术-以太网交换机配置指导(R27xx)
· H3C S6890系列以太网交换机 二层技术-以太网交换机命令参考(R27xx)
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!