MSTP/RSTP与STP的兼容性

原理概述

MSTP(Multiple STP)协议和RSTP(Rapid STP)协议都可以向下兼容STP(Spanning Tree Protocol )协议。运行MSTP/RSTP协议的交换机会根据收到的BPDU版本号信息自动判断与之相连的交换机的运行模式。如果收到的是STP BPDU,MSTP/RSTP交换机就会自动按照STP模式来运行。一个运行在STP模式的交换机会收到MSTP/RSTP的报文后会直接丢弃。

对于运行RSTP/MSTP的交换机,如果某个端口与运行STP的交换机直连,则该端口会自动将其工作模式迁移到STP模式,然后向外发送配置BPDU报文从而保证设备之间的互通。但是在华为的交换机上,如果运行STP的设备被关机或移走,那么MSTP/RSTP交换机的端口无法自动迁移回RSTP/MSTP模式,此时需要在相应的端口上执行Mcheck操作,将端口手动迁移回RSTP/MSTP模式。

实验目的

理解MSTP/RSTP与STP的兼容性原理和应用场景

实验内容

实验拓扑如图所示,本实验模拟了一个企业网络场景,公司A的内部网络是由5台交换机组成的局域网,S1、S2、S3和S4组成环形网络,S5通过集线器HUB1与S4相连,所有交换机运行的是RSTP生成树协议。由于公司A与公司B有业务需要进行合作,公司B的交换机S6通过集线器HUB1与公司A的网络进行相连,公司B的交换机运行的是STP协议,因此,S4和S5会自动降为STP模式。合作期间公司A进行网络优化,所有交换机都运行MSTP协议,但仍然需要能够兼容S6。当两家公司的合作完成之后,S6撤离公司A的网络,S4和S5需要恢复为原来的MSTP模式。

实验拓扑

1.配置RSTP

根据上图进行相应的基本配置,在S1、S2、S3、S4、S5上配置生成树模式为RSTP,并配置S1为根交换机。

S1stp mode rstp

S1stp priority 8192

s2stp mode rstp

s3stp mode rstp

s4stp mode rstp

s5stp mode rstp

配置完成后,查看交换机上的生成树模式,此处仅以S1、S4为例。

S1display stp interface g0/0/1

-------CIST Global InfoMode RSTP-------
CIST Bridge :8192 .4c1f-cc00-425d

Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :8192 .4c1f-cc00-425d / 0

CIST RegRoot/IRPC :8192 .4c1f-cc00-425d / 0

......

s4display stp interface g0/0/2

-------CIST Global InfoMode RSTP-------
CIST Bridge :32768.4c1f-cc09-7274

Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :8192 .4c1f-cc00-425d / 40000

CIST RegRoot/IRPC :32768.4c1f-cc09-7274 / 0

......

可以看到,公司A的交换机都运行在RSTP模式下,且S1为根交换机。为了进一步加快收敛速度,配置S3和S4的Ethernet0/0/1端口为边缘端口。

s3int e0/0/1

s3-Ethernet0/0/1stp edged-port enable

s4int e0/0/1

s4-Ethernet0/0/1stp edged-port enable

2.实现RSTP与STP的兼容

S6通过集线器HUB1接入到公司A的网络。S6运行的是STP协议。配置S6的生成树模式为STP。

s6stp mode stp

在S4和S5上查看Ethernet0/0/2端口的生成树模式。

s4display stp interface Ethernet 0/0/2
-------CIST Global InfoMode RSTP-------

CIST Bridge :32768.4c1f-cc09-7274

Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

CIST Root/ERPC :8192 .4c1f-cc00-425d / 40000

CIST RegRoot/IRPC :32768.4c1f-cc09-7274 / 0

CIST RootPortId :128.24

BPDU-Protection :Disabled

TC or TCN received :50

TC count per hello :0

STP Converge Mode :Normal

Time since last TC :0 days 0h:0m:59s

Number of TC

......

Protection Type :None
Port STP Mode :STP

Port Protocol Type :Config=auto / Active=dot1s

<s5>display stp interface Ethernet0/0/2
-------CIST Global InfoMode RSTP-------

CIST Bridge :32768.4c1f-cc61-487b

Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

......

Last TC occurred :Ethernet0/0/2

----Port2(Ethernet0/0/2)FORWARDING----

Port Protocol :Enabled

.....

Protection Type :None
Port STP Mode :STP

Port Protocol Type :Config=auto / Active=dot1s

......

可以看到,S4和S5全局的生成树模式依然是RSTP,但与S6相连的端口的生成树模式已经变成了STP。

在S6上查看STP生成树信息。

s6display stp interface Ethernet 0/0/2
-------CIST Global InfoMode STP-------

CIST Bridge :32768.4c1f-cc81-3b6e

Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :8192 .4c1f-cc00-425d / 240000

CIST RegRoot/IRPC :32768.4c1f-cc81-3b6e / 0

......

可以看到,S4和S5全局的生成树模式依然是RSTP,但与S6相连的端口的生成树模式已经变成了STP。

在S6上查看STP生成树信息。

s6display stp interface Ethernet 0/0/2
-------CIST Global InfoMode STP-------

CIST Bridge :32768.4c1f-cc81-3b6e

Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :8192 .4c1f-cc00-425d / 240000

CIST RegRoot/IRPC :32768.4c1f-cc81-3b6e / 0

......

可以看到,S6上生成树模式为STP ,且根交换机为S1,所以S6已经加入到整个交换网络的生成树当中,RSTP兼容了STP。

如果公司网络内发生了链路故障,比如S4与S2之间的链路Down掉,就会造成生成树端口发生迁移。使用命令display stp brief查看端口状态。

s4-GigabitEthernet0/0/2 q

s4int g0/0/2

s4-GigabitEthernet0/0/2shutdown

s4-GigabitEthernet0/0/2display stp brief

MSTID Port Role STP State Protection

0 Ethernet0/0/1 DESI FORWARDING NONE

0 Ethernet0/0/2 DESI DISCARDING NONE

0 GigabitEthernet0/0/1 ROOT FORWARDING NONE

s4display stp brief

MSTID Port Role STP State Protection

0 Ethernet0/0/1 DESI FORWARDING NONE

0 Ethernet0/0/2 DESI LEARNING NONE

0 GigabitEthernet0/0/1 ROOT FORWARDING NONE

s4display stp brief

MSTID Port Role STP State Protection

0 Ethernet0/0/1 DESI FORWARDING NONE
0 Ethernet0/0/2 DESI FORWARDING NONE

0 GigabitEthernet0/0/1 ROOT FORWARDING NONE

可以看到,S4的 Ethernet 0/0/1以及 GE 0/0/1这两个运行 RSTP 的端口,使用 RSTP 的 P / A 机制由 Discarding 状态快速进入到了 Forwarding 状态。而与S6相连,运行 STP 协议的 Ethernet 0/0/2端口还停留在 Discarding 状态,需要经历 Learning 状态后再到 Forwarding 状态,所以当运行 STP 的交换机加入到 RSTP 网络中后,会造成生成树网络的收敛时间变慢。

3.实现 MSTP 与 STP 的兼容

公司 A 根据业务需求优化网络,配置所有交换机运行MSTP 协议。

S1stp mode mstp

S2stp mode mstp

S3stp mode mstp

S4stp mode mstp

S5stp mode mstp

配置完成后,查看S4、S5与S6相连端口的生成树状态,此处以S4为例。

s4display stp interface Ethernet 0/0/2
-------CIST Global InfoMode MSTP-------

CIST Bridge :32768.4c1f-cc09-7274

......

Last TC occurred :GigabitEthernet0/0/2

----Port2(Ethernet0/0/2)FORWARDING----

Port Protocol :Enabled

......

Protection Type :None
Port STP Mode :STP

Port Protocol Type :Config=auto / Active=dot1s

......

可以看到,S4的全局生成树模式已经变为 MSTP ,但是 Ethernet 0/0/2端口的生成树模式却是 STP ,可见 MSTP 兼容了 STP ,兼容现象与 RSTP 兼容 STP 现象一致,这里不再赘述。

4.交换机端口迁移

公司 A 与公司 B 的合作结束后,S6交换机撤离公司 A 的网络。此时,为了提高网络的运行效率,需要恢复S4和S5的生成树模式为 MSTP

在S6上关Ehernet0/0/2端口,在S4和S5上使用命令display stp interface Ethernet 0/0/2查看端口协议状态。

s6int e0/0/2

s6-Ethernet0/0/2shutdown

s6display stp interface Ethernet 0/0/2
-------CIST Global InfoMode MSTP-------

CIST Bridge :32768.4c1f-cc81-3b6e

......

----Port2(Ethernet0/0/2)DOWN----

Port Protocol :Enabled

......

Protection Type :None
Port STP Mode :STP

Port Protocol Type :Config=auto / Active=dot1s

......
<s5>display stp int e0/0/2
-------CIST Global InfoMode MSTP-------

CIST Bridge :32768.4c1f-cc61-487b

......

----Port2(Ethernet0/0/2)FORWARDING----

Port Protocol :Enabled

......

Protection Type :None
Port STP Mode :STP

Port Protocol Type :Config=auto / Active=dot1s

......

可以看到,虽然S6已经撤离了MSTP网络,但是S4和S5的Ethernet 0/0/2端口协议模式仍为STP,无法自动迁移回MSTP模式,造成公司A的生成树网络无法实现快速收敛。此时需要在S4和S5的Ethernet0/0/2端口使用命令stp mcheck,使端口模式从STP迁移回MSTP。

s4interface e0/0/2

s4-Ethernet0/0/2stp mcheck

s5interface e0/0/2

s5-Ethernet0/0/2stp mcheck

配置完成后,重新查看S4和S5的Ethernet0/0/2端口协议模式。

s4display stp interface Ethernet 0/0/2

-------CIST Global InfoMode MSTP-------

CIST Bridge :32768.4c1f-cc09-7274

......

----Port2(Ethernet0/0/2)FORWARDING----

Port Protocol :Enabled

......

Protection Type :None
Port STP Mode :MSTP
s5display stp interface Ethernet 0/0/2

-------CIST Global InfoMode MSTP-------

CIST Bridge :32768.4c1f-cc61-487b

......

----Port2(Ethernet0/0/2)FORWARDING----

Port Protocol :Enabled

......

Protection Type :None

Port STP Mode :MSTP

Port Protocol Type :Config=auto / Active=dot1s

......

可以看到,S4和S5的Ethernet 0/0/2端口协议模式已经恢复为MSTP,提高了公司A的整个交换网络的运行效率。

相关推荐
小乖写代码16 小时前
提交注册验证 · WhatsApp /v2/register
android·网络·账号注册
多弗朗皮卡丘17 小时前
网络基础:数据链路层与其他协议或技术
linux·网络·tcp/ip
我不会插花弄玉1 天前
9.数据链路层【由浅入深-网络】
网络
进击的荆棘1 天前
Linux网络——网络基础概念
linux·运维·服务器·网络
LightBreeze20021 天前
从 LSA 到路由计算,彻底理解 OSPF 的区域路由与防环机制
网络·智能路由器·ospf·lsa·spf
忆挽篱笙歌1 天前
通信连接,匿名管道
linux·服务器·网络
九英里路2 天前
protobuf快速上手
网络·c++·中间件·json·谷歌·序列化·protobuf
女神下凡2 天前
芯参谋(107):杰理AC_中科蓝讯_开发指南
linux·服务器·网络·单片机·嵌入式硬件
爱和冰阔落2 天前
【Linux网络】TCP 半包粘包怎么解决?从长度报头、JSON 拆包到网络计算器完整实战
linux·运维·网络·tcp/ip
say_fall2 天前
【Linux网络编程】UDP套接字编程:系统编程组件、基础回显服务、InetAddr与地址转换、翻译服务与线程池聊天室
linux·服务器·网络·udp·vr