5、配置域间MSTP
5.1 测试拓扑

保持之前MSTP配置不变,DeviceA~DeviceE都配置为MSTP Region: RZ1 。
增加DeviceE,并配置为MSTP Region: RZ2 。
在DeviceE上创建VLAN2~20,并将端口GE1/0/1和GE1/0/2分别加入VLAN。
DeviceE配置:
bash
#
stp region-configuration
region-name RG2
#
stp pathcost-standard legacy
#
interface GE1/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 20
#
interface GE1/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 20
#
5.2 MSTP 的域间(Inter-region)工作机制
5.2.1 前情回顾:MSTP 域内机制
在深入探讨域间机制之前,我们简要回顾域内(Intra-region)的核心逻辑:
- 域的定义: 通过配置名称、修订号和 VLAN 映射表三要素严格匹配形成的集合。
- IST(MSTI0): 域内唯一的"信令通道",负责交换 BPDUs。
- MSTI(多实例): 实际上是"搭载"在 IST 的 MRecord 字段中进行传播的。
- 独立性: 在域内,每个 MSTI 可以有独立的根桥和拓扑,实现 VLAN 级别的负载分担。
然而,当网络中存在多个 MSTP 域,或者 MSTP 域与运行传统 STP/RSTP 的网络连接时,情况变得更加复杂。此时,MSTP 引入了 CIST(Common and Internal Spanning Tree,公共和内部生成树) 的概念来解决全网的连通性问题。
5.2.2 CIST:公共和内部生成树
当多个 MSTP 域互联时,整个网络需要构建一棵能够覆盖所有域的"单生成树",这棵树被称为 CIST 。
CIST 从逻辑上可以划分为两个层次的层次结构:
- CST(Common Spanning Tree,公共生成树): 这是"宏观"层面的生成树。它将每一个 MSTP 域视为一台逻辑上的"虚拟网桥(Virtual Bridge)",并连接这些虚拟网桥以及独立的 STP/RSTP 交换机。
- IST(Internal Spanning Tree,内部生成树): 这是"微观"层面的生成树。它是每个 MSTP 域内部运行的生成树实例(即 MSTI0)。
简而言之,CIST = CST(域间链路) + IST(域内链路)。 所有域共同构建这一棵 CIST,确保全网(无论跨越多少个域)没有环路。
5.2.3 端口角色与边界识别
为了实现域间通信,交换机首先需要识别端口的角色:
- 边界端口(Boundary Port): 当一台 MSTP 交换机的端口连接到另一个 MSTP 域的交换机,或者连接到运行 STP/RSTP/PVST+ 的传统交换机时,该端口被标记为边界端口。
- 内部端口(Internal Port): 连接同一域内其他交换机的端口。
- 边界交换机(Boundary Switch): 至少拥有一个边界端口的交换机。
注意:
- 内部端口参与域内IST(即MSTI0)以及其他MSTI的STP计算,但不参与CST的计算。
- 边界端口参与CST的计算,但不参与IST以及MSTI的计算。所以CST、IST、MSTI的STP相互独立,相互不受影响。
5.2.4 两个关键的根桥角色
在 MSTP 域间环境下,BPDU(协议版本为 Version 3)中包含两个至关重要的信息块,用于选举两类不同的"根":
- CIST Root(CIST 总根)
- 定义: 在全网所有区域(All Regions) 中,Bridge ID(优先级+MAC)最小的交换机。
- 位置: 它可以位于任何一个域中,也可以是一台独立的非 MSTP 交换机。
- 作用: 它是整个 CIST 生成树的树根。
- CIST Regional Root(CIST 域根)
- 定义: 在每一个非总根所在的域中,都会选举出一台特定的边界交换机作为该域的"域根"。
- 选举依据: 谁距离 CIST 总根最近(基于外部路径开销),谁就是该域的 CIST Regional Root。
- 作用:
- 它作为该域在 CST 层面上的"代表"。
- 关键转换:** 在该域内部,CIST Regional Root 自动成为该域 IST(实例0)的根桥。
- 注意: 所在的域包含 CIST 总根的那个域,其"CIST 域根"就是"CIST 总根"本身。
5.2.5 虚拟网桥(Virtual Bridge)与拓扑计算
MSTP 域间机制的核心设计思想是"黑盒化"。
- 外部视角:虚拟网桥
从外部(即 CST 的视角)来看,整个 MSTP 域被视为一台单独的"虚拟网桥"。
- 这台虚拟网桥的 Bridge ID 等于该域 CIST Regional Root 的 ID。
- 该域所有的边界端口,就好比是这台虚拟网桥的端口。
- 域内的复杂拓扑细节对外部完全隐藏。
- 路径开销的计算(Internal vs External)
为了支持这种分层结构,MSTP 使用了两种不同的开销计算:
- CIST 外部根路径开销(External Root Path Cost):
- 这是到达 CIST 总根的开销。
- 该开销在域内传播时保持不变。即:域内所有交换机看到的"到达总根的外部开销"都是一样的(等于域根在边界上计算出的值)。
- 只有在跨越边界链路(域间链路)时,该值才会累加。
- CIST 内部根路径开销(Internal Root Path Cost):
- 这是域内交换机到达本域 CIST Regional Root 的开销。
- 这遵循标准的 RSTP 计算规则。
- 选举与收敛过程
- 初始化: 每台交换机启动时都自认为是 CIST 总根和 CIST 域根。
- 比较与更新: 交换机交换 BPDU。边界交换机如果在边界端口收到更优的 BPDU(通向更优的总根),它会放弃域根身份,转而指向新的总根。
- 最终状态: 每个域选出一台边界交换机作为 CIST Regional Root(距离总根最近)。该交换机的一个边界端口成为根端口,其余边界端口被阻塞或成为指定端口。
5.2.6 MSTI 的域间行为与 Master 端口
在域间通信时,MSTP 有一个核心限制:MSTI 的独立性仅存在于域内,在域边界必须统一映射到 CIST。
- 边界上的 VLAN 映射(Mapping MSTI's to CIST)
在 MSTP 域内,管理员可以将 VLAN 映射到不同的实例(MSTI)以实现负载分担。但是,一旦涉及到域边界端口(连接其他域或传统交换机的端口):- 统一状态: 域边界端口的状态(Forwarding 或 Blocking)完全由 CIST(即 CST) 的计算结果决定。
- 无独立策略: 所有的 VLAN(无论它们在域内属于哪个 MSTI)在经过边界链路时,都必须遵循 CIST 的端口状态。
- 如果 CIST 将某个边界端口阻塞,该端口对所有 VLAN 都是阻塞的。
- 如果 CIST 将某个边界端口置为转发,该端口对所有 VLAN 都是转发的。
- 结果: 这意味着无法在两台交换机的域间链路上实现基于 VLAN 的多实例负载分担。
- Master 端口(Master Port)的准确定义
"Master 端口"是一个逻辑概念,它特定于 CIST 域根(CIST Regional Root):- 定义: CIST 域根上那个指向 CIST 总根的边界端口(即 CIST Root Port),被定义为 Master 端口。
- 作用: 它是连接域内所有 MSTI 到 CIST 总根的"逻辑桥梁"。
- 对于域内的 MSTI(实例 1, 2...)而言,它们并不知道域外的拓扑。它们只知道自己的根是 CIST 域根。
- 当 MSTI 需要计算"到达 CIST 总根"的路径时,它们将 Master 端口视为连通外部世界的上行网关。
- 流量出域的两种路径
域内 VLAN 的流量出域并不局限于 Master 端口,而是取决于目标地址在 CST 树上的位置:- 向上游(Towards CIST Root): 如果流量的目的地位于 CIST 总根方向(或需要经过总根转发),流量会汇聚指向 Master 端口 出域。
- 向下游(Away from CIST Root): 如果本域是连接 CIST 总根和下游域的"中转域",本域的边界交换机上会有 CIST 指定端口(Designated Port)。去往下游区域的流量会通过这些非阻塞的边界指定端口出域。
- 向上游(Towards CIST Root): 如果流量的目的地位于 CIST 总根方向(或需要经过总根转发),流量会汇聚指向 Master 端口 出域。
注意:
Master 端口仅代表本域通往 CIST 树根方向的唯一出口;而通往树枝方向(下游其他域)的出口则是本域边界交换机上的指定端口。所有 VLAN 在边界上的转发行为,严格"同进同出",受控于 CIST 的单一拓扑。
5.2.7 总结:域间运作全景
- CST 连接域: 整个网络由 CST 连接各个"域"(虚拟网桥)。
- CIST 总根统领全网: 全网选举唯一的 CIST Root。
- 域根(Regional Root)作为代理: 每个域选出距离总根最近的边界交换机作为域根。
- IST 负责域内: 域根成为域内的 IST 根,构建域内连通性。
- MSTI 依附 CIST 边界: 域内多实例虽然独立计算拓扑,但在域边界上,所有 MSTI 必须统一映射到 CIST 的端口状态。这意味着所有 VLAN 只能共用 CIST 选定的非阻塞边界端口(包括 Master 端口或边界指定端口)进出,导致无法在域间链路上实现基于 VLAN 的多生成树负载分担。
5.3 检查配置结果
5.3.1 CIST逻辑拓扑图

这张图片展示了一个典型的 MSTP(多生成树协议)网络拓扑图,重点演示了 MSTP 域内(IST)和域间(CST)的协同工作机制。
以下是对图中各个要素的详细描述:
1. 网络分区(Regions)
图片将网络划分为两个 MSTP 域:
- Region: RZ1(下方红色虚线框):
- 包含四台交换机:DeviceA 、DeviceB 、DeviceC 、DeviceD。
- 它们组成了一个环形拓扑。
- 连接了两个终端用户:PC-CLIENT-1 和 PC-CLIENT-2。
- Region: RZ2(上方蓝色虚线框):
- 包含一台交换机:DeviceE。
2. 关键角色选举(Roles)
- CIST Root(总根):
- DeviceB 被标记为 CIST Root 。它的 Bridge ID 是
fae8-d2bf-0011。 - 它是整个网络(RZ1 + RZ2)中优先级最高的交换机。
- 同时,它也是 RZ1 Region Root(RZ1 域根)。
- DeviceB 被标记为 CIST Root 。它的 Bridge ID 是
- RZ2 Region Root(RZ2 域根):
- DeviceE 被标记为 RZ2 Region Root 。它的 Bridge ID 是
fae8-d2bf-0071。 - 在 RZ2 域内,它是距离总根最近(或优先级最高)的设备。
- DeviceE 被标记为 RZ2 Region Root 。它的 Bridge ID 是
3. 链路与端口状态
图片清晰地展示了两种不同层级的生成树计算:
A. 域间连接(CST - Common Spanning Tree)
- 位置: 图中上方 RZ1 与 RZ2 之间的链路,标有蓝色的 CST 字样。
- 规则: 对应右侧说明 "1、区域间互联端口为边界端口,参与 CST 计算"。
- 端口状态:
- DeviceA 和 DeviceB 连接 DeviceE 的端口均为 DP(指定端口)。
- DeviceE(RZ2)作为下游设备,需要选出一个根端口去往 CIST Root(DeviceA)。
- RP(根端口): DeviceE 的 GE1/0/2 被选为 RP。
- ALT(阻塞端口): DeviceE 的 GE1/0/1 被标记为 ALT,处于阻塞状态,以防止域间环路。
B. 域内连接(IST - Internal Spanning Tree)
- 位置: 图中 RZ1 内部的链路,标有黄色的 IST (MIST 0) 字样。
- 规则: 对应右侧说明 "2、区域内端口为内部端口,参与 IST,即 MIST0 计算"。
- 端口状态:
- 由于 DeviceB 是根桥,其所有内部接口(GE1/0/1, GE1/0/2)均为 DP。
- DeviceA 和 DeviceD 直连 DeviceA 的接口均为 RP。
- 环路打破: 在 DeviceC 和 DeviceD 之间的链路上,DeviceC 的 GE1/0/2 被标记为 ALT(阻塞),从而打破了 RZ1 内部的物理环路。
4. 总结
这张图直观地解释了我们之前讨论的理论:
- 分层计算: 外部看 CST(把 RZ1 和 RZ2 当作两个大节点),内部看 IST(具体的环路细节)。
- 边界隔离: 域间端口只跑 CST,域内端口跑 IST。
- 单点阻塞: 无论网络多么复杂,MSTP 最终保证了 CIST Root 到任意节点只有一条逻辑链路(图中的 ALT 端口均已阻塞冗余路径)。
5.3.2 Region配置信息
DeviceA:
bash
[DeviceA]dis stp region-configuration
Operating configuration
Format selector :0
Region name :RG1
Revision level :0
Instance VLAN
0 1, 21 to 4094
1 2 to 10
2 11 to 20
DeviceE:
bash
[DeviceE]dis stp region-configuration
Operating configuration
Format selector :0
Region name :RG2
Revision level :0
Instance VLAN
0 1 to 4094
基于您提供的 DeviceA 和 DeviceE 的配置信息,结合之前的拓扑图和 MSTP 域间机制理论,我们可以进行深入的分析。
1. 核心结论:确认处于不同的 MSTP 域
从输出信息可以明确判定,DeviceA 和 DeviceE 属于两个完全不同的 MSTP 域。
判断依据(MSTP 域的三要素):
- 域名(Region Name):
- DeviceA:
RG1 - DeviceE:
RG2 - 分析: 域名不同,直接决定了它们属于不同的域。
- DeviceA:
- VLAN 映射表(VLAN Mapping):
- DeviceA: 配置了 MSTI 1 (VLAN 2-10) 和 MSTI 2 (VLAN 11-20)。
- DeviceE: 所有 VLAN (1-4094) 都映射到 Instance 0 (IST)。
- 分析: 映射关系完全不同,即使域名相同,计算出的配置摘要(Digest)也不一致,互不兼容。
2. 域内视角的差异(Intra-region View)
-
Region RG1 (DeviceA 所在域):
- 这是一个多实例环境。
- 流量负载分担: 在 RG1 内部,管理员意图实现流量分流。
- VLAN 2-10 的流量将遵循 MSTI 1 的生成树拓扑转发。
- VLAN 11-20 的流量将遵循 MSTI 2 的生成树拓扑转发。
- 其他 VLAN 走 IST (MSTI 0)。
- 这意味着在 RG1 内部,不同业务的 VLAN 可能走不同的物理链路。
-
Region RG2 (DeviceE 所在域):
- 这是一个单实例环境(类似传统的 RSTP)。
- 所有 VLAN (1-4094) 全部绑定在 Instance 0 (IST) 上。
- 在 RG2 内部,所有流量共享同一棵生成树,没有负载分担。
3. 域间视角的交互(Inter-region Behavior)
这是最关键的部分,结合我们刚才编写的文档,分析 RG1 和 RG2 边界上的行为:
A. 拓扑计算归一化 (CIST)
- 由于处于不同域,DeviceA 和 DeviceE 之间的互联链路(边界链路)只能进行 CIST (Common and Internal Spanning Tree) 的计算。
- DeviceA 发送给 DeviceE 的 BPDU 报文(Version 3)中:
- 会携带 CIST 的信息(用于防止全网环路)。
- 会 携带关于 MSTI 1 和 MSTI 2 的 M-Record 信息。因为 DeviceE 根本识别不了 RG1 定义的实例 1 和 2从而忽略此信息。
B. VLAN 流量的"降维"打击
我们在文档中提到的 "MSTI 在边界必须统一映射到 CIST" 在这里体现得淋漓尽致:
- 在 DeviceA 侧 (RG1 内部): VLAN 10 的流量是跑在 MSTI 1 上的,VLAN 20 的流量是跑在 MSTI 2 上的。
- 到达边界链路 (DeviceA -> DeviceE):
- 一旦流量要出域,MSTI 1 和 MSTI 2 的独立性瞬间消失。
- VLAN 2-10 和 VLAN 11-20 的流量状态,完全取决于 CIST 对该边界端口的状态判定。
- 如果 CIST 判定该端口转发,所有这些 VLAN 都转发;如果阻塞,全阻塞。
- 进入 DeviceE 侧 (RG2 内部):
- DeviceE 收到 VLAN 10 或 VLAN 20 的数据帧后,它完全不知道这些帧在上一家(RG1)是属于哪个实例的。
- DeviceE 查找自己的配置表,发现 VLAN 10 和 20 都属于 Instance 0。
- 因此,DeviceE 会按照 RG2 的 IST (Instance 0) 的拓扑规则来转发这些流量。
4. 总结与潜在风险提示
- 配置现状: DeviceA 精细化管理(多实例),DeviceE 粗放管理(单实例)。
- 互通性: 完全可以互通,符合标准。
- 设计意图落空风险:
- 管理员在 DeviceA (RG1) 做了多实例配置,通常是为了负载分担(例如 VLAN 2-10 走左边,VLAN 11-20 走右边)。
- 但是,如果流量必须经过 DeviceE (RG2),这种负载分担在到达 DeviceE 时就会失效,因为 RG2 只有一个实例,所有流量会汇聚到同一条路径上。
- 这就是 MSTP 域间机制的核心限制:域内的精细化策略无法延伸到域外。
5.3.3 CIST配置信息
DeviceA:
bash
[DeviceA]dis stp
CIST Global Information:
Mode :MSTP
CIST Bridge :32768.fae8-d2bf-0041
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 19
CIST Root/ERPC :32768.fae8-d2bf-0011 / 0
CIST RegRoot/IRPC :32768.fae8-d2bf-0011 / 20
CIST RootPortId :128.2 (GE1/0/2)
BPDU-Protection :Disabled
TC or TCN received :13
TC count per hello :0
STP Converge Mode :Normal
Share region-configuration :Enabled
Time since last TC :0 days 0h:33m:3s
Number of TC :8
Last TC occurred :GE1/0/2
Topo Change Flag :0
CIST Port Information:
Port Id :1
Port Name :GE1/0/1
Port State :Forwarding
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=20
Designated Bridge/Port :32768.fae8-d2bf-0041 / 128.1
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=true
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :MSTP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 19
TC or TCN send :12
TC or TCN received :3
TC Restriction :False
BPDU Sent :1168
TCN: 0, Config: 0, RST: 0, MST: 1168
BPDU Received :96
TCN: 0, Config: 0, RST: 0, MST: 96
Last forwarding time:2025-11-29 07:35:25
Message Age :0
CIST Port Information:
Port Id :2
Port Name :GE1/0/2
Port State :Forwarding
Port Protocol :Enabled
Port Role :Root Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=20
Designated Bridge/Port :32768.fae8-d2bf-0011 / 128.2
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=true
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :MSTP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :5
TC or TCN received :8
TC Restriction :False
BPDU Sent :1102
TCN: 0, Config: 0, RST: 0, MST: 1102
BPDU Received :1077
TCN: 0, Config: 0, RST: 0, MST: 1077
Last forwarding time:2025-11-29 07:34:33
Message Age :0
CIST Port Information:
Port Id :3
Port Name :GE1/0/3
Port State :Forwarding
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=20
Designated Bridge/Port :32768.fae8-d2bf-0041 / 128.3
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=true
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :MSTP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 19
TC or TCN send :11
TC or TCN received :2
TC Restriction :False
BPDU Sent :1148
TCN: 0, Config: 0, RST: 0, MST: 1148
BPDU Received :5
TCN: 0, Config: 0, RST: 0, MST: 5
Last forwarding time:2025-11-29 07:33:04
Message Age :0
MSTI 1 Global Information:
MSTI Bridge ID :0.fae8-d2bf-0041
MSTI RegRoot/IRPC :0.fae8-d2bf-0041 / 0 (This bridge is the root)
MSTI RootPortId :0.0
MSTI Root Type :Primary root
Master Bridge :32768.fae8-d2bf-0011
Cost to Master :20
TC received :14
TC count per hello :0
Time since last TC :0 days 0h:33m:32s
Number of TC :8
Last TC occurred :GE1/0/2
Topo Change Flag :0
MSTI 1 Port Information:
Port Id :1
Port Name :GE1/0/1
Port State :Forwarding
Port Role :Designated Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=20
Desg. Bridge/Port :0.fae8-d2bf-0041 / 128.1
Port Times :RemHops 20
TC or TCN send :12
TC or TCN received :4
Last forwarding time:2025-11-29 07:32:25
MSTI 1 Port Information:
Port Id :2
Port Name :GE1/0/2
Port State :Forwarding
Port Role :Designated Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=20
Desg. Bridge/Port :0.fae8-d2bf-0041 / 128.2
Port Times :RemHops 20
TC or TCN send :7
TC or TCN received :10
Last forwarding time:2025-11-29 07:34:33
MSTI 1 Port Information:
Port Id :3
Port Name :GE1/0/3
Port State :Forwarding
Port Role :Designated Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=20
Desg. Bridge/Port :0.fae8-d2bf-0041 / 128.3
Port Times :RemHops 20
TC or TCN send :11
TC or TCN received :0
Last forwarding time:2025-11-29 07:33:04
MSTI 2 Global Information:
MSTI Bridge ID :4096.fae8-d2bf-0041
MSTI RegRoot/IRPC :0.fae8-d2bf-0011 / 20
MSTI RootPortId :128.2 (GE1/0/2)
MSTI Root Type :Secondary root
Master Bridge :32768.fae8-d2bf-0011
Cost to Master :20
TC received :14
TC count per hello :0
Time since last TC :0 days 0h:33m:32s
Number of TC :8
Last TC occurred :GE1/0/2
Topo Change Flag :0
MSTI 2 Port Information:
Port Id :1
Port Name :GE1/0/1
Port State :Forwarding
Port Role :Designated Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=20
Desg. Bridge/Port :4096.fae8-d2bf-0041 / 128.1
Port Times :RemHops 19
TC or TCN send :12
TC or TCN received :4
Last forwarding time:2025-11-29 07:32:25
MSTI 2 Port Information:
Port Id :2
Port Name :GE1/0/2
Port State :Forwarding
Port Role :Root Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=20
Desg. Bridge/Port :0.fae8-d2bf-0011 / 128.2
Port Times :RemHops 20
TC or TCN send :7
TC or TCN received :10
Last forwarding time:2025-11-29 07:34:33
MSTI 2 Port Information:
Port Id :3
Port Name :GE1/0/3
Port State :Forwarding
Port Role :Designated Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=20
Desg. Bridge/Port :4096.fae8-d2bf-0041 / 128.3
Port Times :RemHops 19
TC or TCN send :11
TC or TCN received :0
Last forwarding time:2025-11-29 07:33:04
[DeviceA]
DeviceE:
bash
[DeviceE]dis stp
CIST Global Information:
Mode :MSTP
CIST Bridge :32768.fae8-d2bf-0071
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.fae8-d2bf-0011 / 20
CIST RegRoot/IRPC :32768.fae8-d2bf-0071 / 0 (This bridge is the root)
CIST RootPortId :128.2 (GE1/0/2)
BPDU-Protection :Disabled
TC or TCN received :17
TC count per hello :0
STP Converge Mode :Normal
Share region-configuration :Enabled
Time since last TC :0 days 0h:36m:48s
Number of TC :6
Last TC occurred :GE1/0/2
Topo Change Flag :0
CIST Port Information:
Port Id :1
Port Name :GE1/0/1
Port State :Discarding
Port Protocol :Enabled
Port Role :Alternate Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=20
Designated Bridge/Port :32768.fae8-d2bf-0041 / 128.3
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=true
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :MSTP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 19
TC or TCN send :2
TC or TCN received :11
TC Restriction :False
BPDU Sent :6
TCN: 0, Config: 0, RST: 0, MST: 6
BPDU Received :1236
TCN: 0, Config: 0, RST: 0, MST: 1236
Last forwarding time:2025-11-29 07:33:53
Message Age :0
CIST Port Information:
Port Id :2
Port Name :GE1/0/2
Port State :Forwarding
Port Protocol :Enabled
Port Role :Root Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=20
Designated Bridge/Port :32768.fae8-d2bf-0011 / 128.3
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=true
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :MSTP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :3
TC or TCN received :6
TC Restriction :False
BPDU Sent :31
TCN: 0, Config: 0, RST: 0, MST: 31
BPDU Received :1188
TCN: 0, Config: 0, RST: 0, MST: 1188
Last forwarding time:2025-11-29 07:34:34
Message Age :0
CIST Port Information:
Port Id :3
Port Name :GE1/0/3
Port State :Down
Port Protocol :Enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=200000
Designated Bridge/Port :32768.fae8-d2bf-0071 / 128.3
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=false
Transit Limit :6 packets/s
Protection Type :None
Port STP Mode :MSTP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :0
TC or TCN received :0
TC Restriction :False
BPDU Sent :0
TCN: 0, Config: 0, RST: 0, MST: 0
BPDU Received :0
TCN: 0, Config: 0, RST: 0, MST: 0
Message Age :0
继续分析CIST状态,注意,DeviceA的mac为fae8-d2bf-0041,DeviceB的mac为fae8-d2bf-0011,DeviceE的mac为fae8-d2bf-0071
基于您提供的 dis stp 详细输出信息,以及确定的 MAC 地址对应关系,我们来深度剖析 CIST(公共和内部生成树)在 DeviceA (域 RG1)和 DeviceE(域 RG2)之间的具体工作状态。
设备身份确认:
- DeviceA (RG1): MAC
...0041,优先级32768。 - DeviceB (RG1): MAC
...0011,优先级32768(根据 DeviceA 和 DeviceE 的 CIST Root 信息推断)。 - DeviceE (RG2): MAC
...0071,优先级32768。
1. 全网 CIST Root 的选举
结论:DeviceB (...0011) 是全网的总根(CIST Root)。
- 分析:
- DeviceA 的输出显示
CIST Root/ERPC : 32768.fae8-d2bf-0011 / 0。 - DeviceE 的输出显示
CIST Root/ERPC : 32768.fae8-d2bf-0011 / 20。 - 在所有设备优先级相同(32768)的情况下,MAC 地址最小的 DeviceB (
...0011) 胜出,成为连接 RG1 和 RG2 的 CST 的树根。
- DeviceA 的输出显示
2. DeviceA (位于 RG1) 的 CIST 状态分析
DeviceA 位于 RG1 内部,且不是总根。
-
CIST Regional Root (域根):DeviceB
- 输出显示
CIST RegRoot/IRPC : 32768.fae8-d2bf-0011 / 20。 - 解读: 因为总根 DeviceB 就在本域(RG1)内,所以本域的"域根"直接就是总根 DeviceB。DeviceA 到 DeviceB 的内部开销(IRPC)为 20。
- 输出显示
-
端口角色分析:
- GE1/0/2 (Root Port):
- 状态
Forwarding,Designated Bridge 是...0011(DeviceB)。 - 解读: 这是 DeviceA 去往根桥 DeviceB 的最短路径接口。
- 状态
- GE1/0/3 (Designated Port):
- 状态
Forwarding,连接对端是 DeviceE。 - 解读: 这是一个边界端口。DeviceA 向 DeviceE 发送 BPDU。由于 DeviceA 距离根桥(开销20)比 DeviceE 绕行(如果存在环路)更近,所以 DeviceA 在此链路上是指定桥。
- 状态
- GE1/0/1 (Designated Port):
- 状态
Forwarding。通常连接 PC 或下游交换机。
- 状态
- GE1/0/2 (Root Port):
-
MSTI 角色(域内视角):
- MSTI 1: DeviceA 自选为根 (
This bridge is the root)。这意味着在 VLAN 2-10 的逻辑拓扑中,DeviceA 是树根。 - MSTI 2: DeviceA 视 DeviceB 为根(指向
...0011)。
- MSTI 1: DeviceA 自选为根 (
3. DeviceE (位于 RG2) 的 CIST 状态分析
DeviceE 位于独立的 RG2 域,它是 RG2 的边界交换机。
-
CIST Regional Root (域根):DeviceE (自身)
- 输出显示
CIST RegRoot/IRPC : 32768.fae8-d2bf-0071 / 0。 - 解读: RG2 必须选出一个"代表"去连接总根。DeviceE 是 RG2 中唯一(或距离总根最近)的边界设备,因此它成为了 RG2 的 CIST 域根。
- 输出显示
-
CST 路径计算(关键的防环逻辑):
DeviceE 有两个上行接口连接到 RG1(分别连 DeviceB 和 DeviceA),它需要根据 外部路径开销 (ERPC) 来选择唯一的根端口。
-
路径 1 (via GE1/0/2):
- 直连 DeviceB (
...0011)。 - 计算开销:DeviceB 是总根 (Cost 0) + 链路开销 (20) = 20。
- 结果:
GE1/0/2被选为 Root Port (RP) ,状态Forwarding。这是 DeviceE 的Master 端口,所有 VLAN 的流量通过此口出域去往总根。
- 直连 DeviceB (
-
路径 2 (via GE1/0/1):
- 直连 DeviceA (
...0041)。 - DeviceA 报告它距离总根的开销是 20。
- 计算开销:DeviceA 的开销 (20) + 链路开销 (20) = 40。
- 结果: 20 < 40,路径 2 劣后。
- 端口状态:
GE1/0/1被置为 Alternate Port (ALT) ,状态Discarding。
- 直连 DeviceA (
-
4. 综合拓扑逻辑图解
根据以上信息,我们可以还原出精确的逻辑拓扑和阻塞点:
- 物理连接: 存在一个跨域的物理环路
DeviceB -- DeviceA -- DeviceE -- DeviceB。 - CST (域间生成树) 的裁决:
- DeviceB 是老大(总根)。
- DeviceA 处于中间位置(Cost 20)。
- DeviceE 必须在两条上行链路中二选一。
- DeviceE 发现直接连老大 (GE1/0/2) 比通过 DeviceA 转手 (GE1/0/1) 更近。
- 最终状态:
- DeviceE 的 GE1/0/2 畅通,承载所有跨域流量。
- DeviceE 的 GE1/0/1 被 STP 阻塞 (Discarding)。
- DeviceA 的 GE1/0/3 虽然是指定端口 (Forwarding),但对面 DeviceE 的口堵了,所以这条链路实际上不通。
5. 再次验证"域间无法负载分担"
观察 DeviceE 的端口状态:
- GE1/0/1 (ALT/Discarding): 这个端口被阻塞了。
- 虽然 DeviceA 在域 RG1 内对 MSTI 1(VLAN 2-10)是根桥,可能希望流量走 DeviceA。
- 但是,DeviceE 根本不在乎 RG1 的内部 MSTI。DeviceE 只看 CIST。
- 在 CIST 的计算中,GE1/0/1 路径开销大,必须阻塞。
- 结论: 无论 RG1 内部如何规划 VLAN 路径,RG1 与 RG2 之间的流量(所有 VLAN)此刻只能 通过
DeviceB <---> DeviceE这条链路传输。DeviceA <---> DeviceE链路作为冷备。
5.3.4 端口角色和状态
DeviceA:
bash
[DeviceA]dis stp brief
MSTID Port Role STP State Protection Cost Edged
0 GE1/0/1 DESI forwarding none 20 disable
0 GE1/0/2 ROOT forwarding none 20 disable
0 GE1/0/3 DESI forwarding none 20 disable
1 GE1/0/1 DESI forwarding none 20 disable
1 GE1/0/2 DESI forwarding none 20 disable
1 GE1/0/3 DESI forwarding none 20 disable
2 GE1/0/1 DESI forwarding none 20 disable
2 GE1/0/2 ROOT forwarding none 20 disable
2 GE1/0/3 DESI forwarding none 20 disable
[DeviceA]
DeviceE:
bash
[DeviceE]dis stp brief
MSTID Port Role STP State Protection Cost Edged
0 GE1/0/1 ALTE discarding none 20 disable
0 GE1/0/2 ROOT forwarding none 20 disable
[DeviceE]
基于 display stp brief 的简要信息,我们可以非常清晰地看到 MSTP 在域内多实例差异化 与域间统一化这两种场景下的具体表现。
以下是对 DeviceA 和 DeviceE 端口角色与状态的详细分析:
1. DeviceE 的分析:单纯的 CIST 视角(域间接收端)
DeviceE 位于 RG2(单实例域),它只运行 Instance 0。它的行为完全遵循 CIST(公共生成树) 的计算结果。
-
GE1/0/2 (ROOT / Forwarding):
- 分析: 这是 DeviceE 的根端口(Master 端口)。
- 原因: 该端口直连 DeviceB(CIST 总根)。路径开销最小(20)。
- 作用: 所有从 DeviceE 发出、去往 RG1 或其他网络的流量,无论属于哪个 VLAN,都必须走这个接口。
-
GE1/0/1 (ALTE / Discarding):
- 分析: 这是替代端口(Alternate Port),处于阻塞状态。
- 原因: 该端口连接 DeviceA。通过 DeviceA 到达总根的开销是 40(20+20),比走 GE1/0/2(开销20)要差。为了防止
DeviceB-DeviceA-DeviceE-DeviceB之间的域间环路,CIST 算法强制阻塞了此端口。 - 结论: 这条物理链路在逻辑上断开了。
2. DeviceA 的分析:多实例的精细操控(域内视角)
DeviceA 位于 RG1(多实例域),我们可以看到三个实例(0, 1, 2)呈现出不同的端口角色,这正是 MSTP 的魅力所在,但也展示了边界的局限性。
Instance 0 (IST - 内部生成树/CIST)
- GE1/0/2 (ROOT / Forwarding): 指向总根 DeviceB 的根端口。
- GE1/0/1 & GE1/0/3 (DESI / Forwarding): 指定端口,负责向下游转发。
Instance 2 (MSTI 2 - VLAN 11-20)
- 状态与 Instance 0 完全一致。
- 原因: 在 MSTI 2 中,根桥也是 DeviceB。因此,DeviceA 计算出的树形结构与 IST 一模一样。GE1/0/2 依然是去往根的最短路径。
Instance 1 (MSTI 1 - VLAN 2-10) ------ 关键差异点
- GE1/0/2 (DESI / Forwarding):
- 注意: 在 Instance 0 和 2 中,这个口是 ROOT(去往根);但在 Instance 1 中,它变成了 DESI(指定端口)。
- 原因: 之前的详细信息显示,DeviceA 自己是 MSTI 1 的根桥。
- 逻辑: 既然 DeviceA 是树根,它就没有"根端口"(去往别人的口),它所有的端口都变成了"指定端口"(向下分发数据的口)。
- 效果: 在 RG1 域内,VLAN 2-10 的流量走向发生了改变。流量不再是流向 DeviceB,而是以 DeviceA 为中心向外扩散。
3. 深度解析:边界端口 GE1/0/3 的"假象"
请特别关注连接 DeviceE 的边界端口 GE1/0/3:
-
在 DeviceA 上:
- Instance 0: DESI / Forwarding
- Instance 1: DESI / Forwarding
- Instance 2: DESI / Forwarding
- 现象: DeviceA 认为这个口对所有实例都是通的,都在拼命转发状态。
-
在 DeviceE 上 (对端):
- Instance 0: ALTE / Discarding
- 现象: DeviceE 直接把这个口堵死了。
-
结论与技术原理(Mapping MSTI to CIST):
- 单侧一厢情愿: 虽然 DeviceA 在 MSTI 1 中是根桥,它希望通过 GE1/0/3 把 VLAN 2-10 的流量发给 DeviceE。DeviceA 的状态机显示为 Forwarding 是因为它在 CIST 层面是指定桥。
- 物理阻断: 但是,链路的通断是由双方 决定的。由于对端 DeviceE 的 CIST 判定该链路次优并将其阻塞(Discarding),物理链路上不会有任何流量通过。
- 域间无独立性: 哪怕 DeviceA 想通过 GE1/0/3 专门给 VLAN 2-10 供货(负载分担),也做不到。因为 DeviceE 那个口堵了,所有 VLAN(0, 1, 2)的流量都过不去。
- 最终流向: DeviceE 如果需要访问 DeviceA 负责的 VLAN 2-10,它必须走 GE1/0/2 -> DeviceB -> DeviceA。
4. 总结
- 域内 (DeviceA 视角): 成功实现了负载分担。Instance 1 的拓扑与 Instance 0/2 不同(端口角色从 ROOT 变为 DESI),流量路径在域内是分离的。
- 域间 (DeviceA - DeviceE 视角): 负载分担失效。受限于 CIST 的防环机制,DeviceE 阻塞了 GE1/0/1。MSTP 的多实例灵活性在碰到域边界(尤其是连接单实例域)时,被强制收敛为单一的 CIST 拓扑。
5.4 Wireshark抓包分析
在DeviceA GE1/0/2(域内BPDU)和GE1/0/3(域间BPDU)抓包。
5.4.1 DeviceA GE1/0/2(域内BPDU)

DeviceB发往DeviceA:
bash
Frame 1: Packet, 151 bytes on wire (1208 bits), 151 bytes captured (1208 bits)
IEEE 802.3 Ethernet
Destination: 01:80:c2:00:00:00
Source: fa:e8:d2:bf:00:11
Length: 137
[Stream index: 0]
Logical-Link Control
DSAP: Spanning Tree BPDU (0x42)
SSAP: Spanning Tree BPDU (0x42)
Control field: U, func=UI (0x03)
Spanning Tree Protocol
Protocol Identifier: Spanning Tree Protocol (0x0000)
Protocol Version Identifier: Multiple Spanning Tree (3)
BPDU Type: Rapid/Multiple Spanning Tree (0x02)
BPDU flags: 0x7c, Agreement, Forwarding, Learning, Port Role: Designated
0... .... = Topology Change Acknowledgment: No
.1.. .... = Agreement: Yes
..1. .... = Forwarding: Yes
...1 .... = Learning: Yes
.... 11.. = Port Role: Designated (3)
.... ..0. = Proposal: No
.... ...0 = Topology Change: No
Root Identifier: 32768 / 0 / fa:e8:d2:bf:00:11
Root Path Cost: 0
Bridge Identifier: 32768 / 0 / fa:e8:d2:bf:00:11
Port identifier: 0x8002
Message Age: 0
Max Age: 20
Hello Time: 2
Forward Delay: 15
Version 1 Length: 0
Version 3 Length: 96
MST Extension
MST Config ID format selector: 0
MST Config name: RG1
MST Config revision: 0
MST Config digest: ae026bce3969d5e1ccc584483ad6efdd
CIST Internal Root Path Cost: 0
CIST Bridge Identifier: 32768 / 0 / fa:e8:d2:bf:00:11
CIST Bridge Priority: 32768
CIST Bridge Identifier System ID Extension: 0
CIST Bridge Identifier System ID: fa:e8:d2:bf:00:11
CIST Remaining hops: 20
MSTID 1, Regional Root Identifier 0 / fa:e8:d2:bf:00:41
MSTI flags: 0x78, Agreement, Forwarding, Learning, Port Role: Root
0... .... = Topology Change Acknowledgment: No
.1.. .... = Agreement: Yes
..1. .... = Forwarding: Yes
...1 .... = Learning: Yes
.... 10.. = Port Role: Root (2)
.... ..0. = Proposal: No
.... ...0 = Topology Change: No
0000 .... = Priority: 0x0
.... 0000 0000 0001 = MSTID: 1
Regional Root: fa:e8:d2:bf:00:41
Internal root path cost: 20
Bridge Identifier Priority: 1
Port identifier priority: 8
Remaining hops: 20
MSTID 2, Regional Root Identifier 0 / fa:e8:d2:bf:00:11
MSTI flags: 0x7c, Agreement, Forwarding, Learning, Port Role: Designated
0... .... = Topology Change Acknowledgment: No
.1.. .... = Agreement: Yes
..1. .... = Forwarding: Yes
...1 .... = Learning: Yes
.... 11.. = Port Role: Designated (3)
.... ..0. = Proposal: No
.... ...0 = Topology Change: No
0000 .... = Priority: 0x0
.... 0000 0000 0010 = MSTID: 2
Regional Root: fa:e8:d2:bf:00:11
Internal root path cost: 0
Bridge Identifier Priority: 0
Port identifier priority: 8
Remaining hops: 20
DeviceA发往DeviceB:
bash
Frame 3: Packet, 151 bytes on wire (1208 bits), 151 bytes captured (1208 bits)
IEEE 802.3 Ethernet
Destination: 01:80:c2:00:00:00
Source: fa:e8:d2:bf:00:41
Length: 137
[Stream index: 2]
Logical-Link Control
DSAP: Spanning Tree BPDU (0x42)
SSAP: Spanning Tree BPDU (0x42)
Control field: U, func=UI (0x03)
Spanning Tree Protocol
Protocol Identifier: Spanning Tree Protocol (0x0000)
Protocol Version Identifier: Multiple Spanning Tree (3)
BPDU Type: Rapid/Multiple Spanning Tree (0x02)
BPDU flags: 0x78, Agreement, Forwarding, Learning, Port Role: Root
0... .... = Topology Change Acknowledgment: No
.1.. .... = Agreement: Yes
..1. .... = Forwarding: Yes
...1 .... = Learning: Yes
.... 10.. = Port Role: Root (2)
.... ..0. = Proposal: No
.... ...0 = Topology Change: No
Root Identifier: 32768 / 0 / fa:e8:d2:bf:00:11
Root Path Cost: 0
Bridge Identifier: 32768 / 0 / fa:e8:d2:bf:00:11
Port identifier: 0x8002
Message Age: 0
Max Age: 20
Hello Time: 2
Forward Delay: 15
Version 1 Length: 0
Version 3 Length: 96
MST Extension
MST Config ID format selector: 0
MST Config name: RG1
MST Config revision: 0
MST Config digest: ae026bce3969d5e1ccc584483ad6efdd
CIST Internal Root Path Cost: 20
CIST Bridge Identifier: 32768 / 0 / fa:e8:d2:bf:00:41
CIST Bridge Priority: 32768
CIST Bridge Identifier System ID Extension: 0
CIST Bridge Identifier System ID: fa:e8:d2:bf:00:41
CIST Remaining hops: 20
MSTID 1, Regional Root Identifier 0 / fa:e8:d2:bf:00:41
MSTI flags: 0x7c, Agreement, Forwarding, Learning, Port Role: Designated
0... .... = Topology Change Acknowledgment: No
.1.. .... = Agreement: Yes
..1. .... = Forwarding: Yes
...1 .... = Learning: Yes
.... 11.. = Port Role: Designated (3)
.... ..0. = Proposal: No
.... ...0 = Topology Change: No
0000 .... = Priority: 0x0
.... 0000 0000 0001 = MSTID: 1
Regional Root: fa:e8:d2:bf:00:41
Internal root path cost: 0
Bridge Identifier Priority: 0
Port identifier priority: 8
Remaining hops: 20
MSTID 2, Regional Root Identifier 0 / fa:e8:d2:bf:00:11
MSTI flags: 0x78, Agreement, Forwarding, Learning, Port Role: Root
0... .... = Topology Change Acknowledgment: No
.1.. .... = Agreement: Yes
..1. .... = Forwarding: Yes
...1 .... = Learning: Yes
.... 10.. = Port Role: Root (2)
.... ..0. = Proposal: No
.... ...0 = Topology Change: No
0000 .... = Priority: 0x0
.... 0000 0000 0010 = MSTID: 2
Regional Root: fa:e8:d2:bf:00:11
Internal root path cost: 20
Bridge Identifier Priority: 1
Port identifier priority: 8
Remaining hops: 20
5.4.2 DeviceA GE1/0/3抓包(域间BPDU)

DeviceA发往Device E:
bash
Frame 4: Packet, 151 bytes on wire (1208 bits), 151 bytes captured (1208 bits)
IEEE 802.3 Ethernet
Destination: 01:80:c2:00:00:00
Source: fa:e8:d2:bf:00:41
Length: 137
[Stream index: 1]
Logical-Link Control
DSAP: Spanning Tree BPDU (0x42)
SSAP: Spanning Tree BPDU (0x42)
Control field: U, func=UI (0x03)
Spanning Tree Protocol
Protocol Identifier: Spanning Tree Protocol (0x0000)
Protocol Version Identifier: Multiple Spanning Tree (3)
BPDU Type: Rapid/Multiple Spanning Tree (0x02)
BPDU flags: 0x7c, Agreement, Forwarding, Learning, Port Role: Designated
0... .... = Topology Change Acknowledgment: No
.1.. .... = Agreement: Yes
..1. .... = Forwarding: Yes
...1 .... = Learning: Yes
.... 11.. = Port Role: Designated (3)
.... ..0. = Proposal: No
.... ...0 = Topology Change: No
Root Identifier: 32768 / 0 / fa:e8:d2:bf:00:11
Root Bridge Priority: 32768
Root Bridge System ID Extension: 0
Root Bridge System ID: fa:e8:d2:bf:00:11
Root Path Cost: 0
Bridge Identifier: 32768 / 0 / fa:e8:d2:bf:00:11
Bridge Priority: 32768
Bridge System ID Extension: 0
Bridge System ID: fa:e8:d2:bf:00:11
Port identifier: 0x8003
Message Age: 0
Max Age: 20
Hello Time: 2
Forward Delay: 15
Version 1 Length: 0
Version 3 Length: 96
MST Extension
MST Config ID format selector: 0
MST Config name: RG1
MST Config revision: 0
MST Config digest: ae026bce3969d5e1ccc584483ad6efdd
CIST Internal Root Path Cost: 20
CIST Bridge Identifier: 32768 / 0 / fa:e8:d2:bf:00:41
CIST Bridge Priority: 32768
CIST Bridge Identifier System ID Extension: 0
CIST Bridge Identifier System ID: fa:e8:d2:bf:00:41
CIST Remaining hops: 19
MSTID 1, Regional Root Identifier 0 / fa:e8:d2:bf:00:41
MSTI flags: 0x7c, Agreement, Forwarding, Learning, Port Role: Designated
0... .... = Topology Change Acknowledgment: No
.1.. .... = Agreement: Yes
..1. .... = Forwarding: Yes
...1 .... = Learning: Yes
.... 11.. = Port Role: Designated (3)
.... ..0. = Proposal: No
.... ...0 = Topology Change: No
0000 .... = Priority: 0x0
.... 0000 0000 0001 = MSTID: 1
Regional Root: fa:e8:d2:bf:00:41
Internal root path cost: 0
Bridge Identifier Priority: 0
Port identifier priority: 8
Remaining hops: 20
MSTID 2, Regional Root Identifier 0 / fa:e8:d2:bf:00:11
MSTI flags: 0x7c, Agreement, Forwarding, Learning, Port Role: Designated
0... .... = Topology Change Acknowledgment: No
.1.. .... = Agreement: Yes
..1. .... = Forwarding: Yes
...1 .... = Learning: Yes
.... 11.. = Port Role: Designated (3)
.... ..0. = Proposal: No
.... ...0 = Topology Change: No
0000 .... = Priority: 0x0
.... 0000 0000 0010 = MSTID: 2
Regional Root: fa:e8:d2:bf:00:11
Internal root path cost: 20
Bridge Identifier Priority: 1
Port identifier priority: 8
Remaining hops: 19
5.4.3 抓包分析
这是一份非常精彩的抓包数据,它完美地佐证了我们之前关于 MSTP 域内多拓扑 与域间单拓扑的理论分析。
通过对比 GE1/0/2(内部链路)和 GE1/0/3(边界链路)的报文细节,我们可以清晰地看到 MSTP 协议如何在不同场景下处理实例角色和路径开销。
以下是详细的抓包分析:
一、DeviceA GE1/0/2(域内 BPDU 分析)
这个接口连接 DeviceA 和 DeviceB,两者同属 Region RG1,且互为邻居。
1. 配置摘要匹配(域的证明)
- 在 Frame 1 (DeviceB发) 和 Frame 3 (DeviceA发) 中:
MST Config name: RG1MST Config digest: ae026bce...
- 结论: 两台设备发出的配置摘要(Digest)完全一致,这就像"握手暗号"。正因为暗号对上了,它们才确认彼此在同一个 MSTP 域内,从而开始解析后续的 MSTI(多实例)字段。
2. 角色反转(多生成树的核心体现)
这是最迷人的部分。同一根物理网线,在不同的逻辑实例(Instance)中扮演了完全相反的角色。
-
CIST (Instance 0) & MSTI 2:
- 背景: 根桥是 DeviceB (
...0011)。 - DeviceB (Frame 1): 宣称自己是 Root (
Root Path Cost: 0),端口角色是 Designated (3)。 - DeviceA (Frame 3): 承认 DeviceB 是根,宣称自己到根的开销是 20 (
Internal root path cost: 20),端口角色是 Root (2)。 - 逻辑: DeviceA 是儿子,DeviceB 是父亲。
- 背景: 根桥是 DeviceB (
-
MSTI 1:
- 背景: 根桥是 DeviceA (
...0041)。 - DeviceA (Frame 3): 它是发送方。注意看
MSTID 1字段下的Port Role,显示为 Designated (3) 。且Internal root path cost: 0。这代表 DeviceA 宣称:"在这个实例里,我是老大"。 - DeviceB (Frame 1): 它是发送方。注意看
MSTID 1字段下的Port Role,显示为 Root (2) 。且Regional Root: ...0041。 - 逻辑: 彻底反转!在 MSTI 1 中,DeviceA 变成了父亲,DeviceB 变成了儿子。DeviceB 的 GE1/0/2 接口成为了 MSTI 1 的根端口。
- 背景: 根桥是 DeviceA (
3. 快速收敛机制
- 在两个方向的报文中,
BPDU flags均置位了 Agreement 和 Forwarding。 - 结论: 这表明域内正在运行标准的 RSTP P/A (Proposal/Agreement) 机制,链路状态已经完成了快速握手,处于稳定的转发状态。
二、 DeviceA GE1/0/3(域间 BPDU 分析)
这个接口连接 DeviceA (RG1) 和 DeviceE (RG2)。
1. 信息的"一厢情愿"发送
- 观察 Frame 4 (DeviceA 发给 DeviceE):
- DeviceA 依然发送了包含 RG1 配置名和完整 MSTI 1 / MSTI 2 信息的 BPDU。
- 技术原理: MSTP 端口在发送 BPDU 时,默认不知道对端是否在同一个域。它会诚实地把自己的所有信息(CIST + M-Records)都发出去。
- 接收端的动作(未显示但已知): DeviceE 收到这个包,对比 Config Name 发现是 "RG1"(自己是 RG2),或者对比 Digest 发现不匹配。于是,DeviceE 会直接丢弃所有 MSTI 1 和 MSTI 2 的 M-Record 信息,只提取 CIST 的信息进行计算。
2. 开销计算的奥秘(External vs Internal)
Frame 4 揭示了 MSTP 复杂的开销计算逻辑:
Root Path Cost: 0(在标准头部)- 这实际上是 CIST External Root Path Cost(外部路径开销)。
- 含义: 因为 CIST 的总根(DeviceB)就在 RG1 域内,所以对于 RG1 来说,到达总根的"外部开销"是 0。这个值是给域外设备(如 DeviceE)看的。
CIST Internal Root Path Cost: 20(在 MST Extension 中)- 这是 内部路径开销。
- 含义: DeviceA 告诉邻居:"虽然我们域离总根的外部距离是0,但我自己在域内距离总根(域根)还有 20 的开销。"
- DeviceE 的计算: DeviceE 收到后,结合端口接收开销,算出自己到总根的距离。
3. 端口状态的非对称性
- DeviceA (Frame 4) 宣称:
Port Role: Designated (3),Forwarding: Yes。- DeviceA 认为自己是指定桥,因为它的 CIST Root ID 优于(或同级但路径优于)DeviceE 可能发出的信息。DeviceA 处于转发状态。
- 实际结果(结合上一节 DeviceE 的状态):
- DeviceE 虽然收到了这些包,但经过计算发现通过 DeviceA 是一条次优路径(相比于它直接连 DeviceB)。
- 所以 DeviceE 将对端端口阻塞了 (Discarding)。
- 结论: 尽管 DeviceA 拼命在发包且处于 Forwarding,但链路是对端阻塞的,因此该边界链路实际不通。
4. MSTI 在边界的无效性
- Frame 4 显示 DeviceA 在
MSTID 1中宣称自己是Regional Root且端口是Designated。 - DeviceA 试图告诉 DeviceE:"我是 VLAN 2-10 的根,流量给我。"
- 悲剧的结果: 由于域间隔离,DeviceE 根本不看 MSTID 1 的数据。DeviceE 只看 CIST,判定链路阻塞。因此,DeviceA 在 MSTI 1 上的"根"地位无法延伸到 DeviceE,VLAN 2-10 的流量无法通过此链路流入 RG1。
三、总结 Wireshark 分析
这两份抓包完美验证了 MSTP 的核心机制:
- 域内 (GE1/0/2): 配置摘要匹配,MSTI 生效。物理拓扑上叠加了多个逻辑拓扑(A是MSTI1的根,B是MSTI2的根),实现了真正的负载分担。
- 域间 (GE1/0/3): 虽然发送方包含了所有实例信息,但因配置不匹配,接收方会忽略 MSTI 信息。双方退化为单纯的 CIST 计算。由于 CIST 计算出次优路径,导致边界端口被阻塞,进而导致所有 VLAN(包括本该走这边的 VLAN 2-10)都无法通过,验证了域间无法基于 VLAN 负载分担的特性。