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为根交换机。

[S1]stp mode rstp
[S1]stp priority 8192

[s2]stp mode rstp
 

[s3]stp mode rstp
 

[s4]stp mode rstp
 

[s5]stp mode rstp

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

[S1]display stp interface g0/0/1
-------[CIST Global Info][Mode 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
 ......

[s4]display stp interface g0/0/2
-------[CIST Global Info][Mode 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端口为边缘端口。

[s3]int e0/0/1
[s3-Ethernet0/0/1]stp edged-port enable


[s4]int e0/0/1
[s4-Ethernet0/0/1]stp edged-port enable

2.实现RSTP与STP的兼容

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

[s6]stp mode stp 

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

[s4]display stp interface Ethernet 0/0/2
-------[CIST Global Info][Mode 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 Info][Mode 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生成树信息。

[s6]display stp interface Ethernet 0/0/2
-------[CIST Global Info][Mode 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生成树信息。

[s6]display stp interface Ethernet 0/0/2
-------[CIST Global Info][Mode 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
[s4]int g0/0/2
[s4-GigabitEthernet0/0/2]shutdown

[s4-GigabitEthernet0/0/2]display 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


[s4]display 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

[s4]display 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 协议。

[S1]stp mode mstp
 

[S2]stp mode mstp
 

[S3]stp mode mstp
 

[S4]stp mode mstp
 

[S5]stp mode mstp

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

[s4]display stp interface Ethernet 0/0/2
-------[CIST Global Info][Mode 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查看端口协议状态。 

[s6]int e0/0/2
[s6-Ethernet0/0/2]shutdown

[s6]display stp interface Ethernet 0/0/2
-------[CIST Global Info][Mode 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 Info][Mode 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。

[s4]interface e0/0/2
[s4-Ethernet0/0/2]stp mcheck
 

[s5]interface e0/0/2
[s5-Ethernet0/0/2]stp mcheck

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

[s4]display stp interface Ethernet 0/0/2
-------[CIST Global Info][Mode MSTP]-------
CIST Bridge         :32768.4c1f-cc09-7274
......
----[Port2(Ethernet0/0/2)][FORWARDING]----
 Port Protocol       :Enabled
......
 Protection Type     :None
 Port STP Mode       :MSTP 

[s5]display stp interface Ethernet 0/0/2
-------[CIST Global Info][Mode 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的整个交换网络的运行效率。

  • 29
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值