ENSP Pro Lab笔记:配置STP/RSTP/MSTP(4)

3、配置RSTP

(继续RSTP笔记)

3.5 Proposal/Agreement工作机制分析

通过实验查看和分析Proposal/Agreement以及TC的工作机制。

3.5.1 测试前提

在之前RSTP配置的基础上进行测试。

3.5.2 测试步骤

先把 S-1 的 GE1/0/1、S-2 的 GE1/0/1undo portswitch(端口暂不参与 RSTP,但不 shutdown,方便抓包),然后查看 RSTP 状态基线,随后把这两个口 portswitch 恢复并 参与 RSTP,同时抓包观察 BPDU。

另外由于Edge Port不参与RSTP拓扑计算,所有为简化起见,也关闭Edge Port。

------步骤一:相关端口执行undo portswitch

将S-1的GE1/0/1、S-2的GE1/0/1设置为undo portswitch,此时拓扑变为:

此时,S-1 GE1/0/1和S-2 GE1/0/1均不参与RSTP。

>>相关端口状态

S-1:

复制代码
[S-1]int ge1/0/1
[S-1-GE1/0/1]undo stp root-protection 
[S-1-GE1/0/1]undo portswitch


[S-1]dis int brief
PHY: Physical
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
(b): BFD down
(e): ETHOAM down
(d): Dampening Suppressed
(p): port alarm down
(dl): DLDP down
(c): CFM down
(sd): STP instance discarding
(ms): MACsec down
(ed): error down
(lb): LBDT block
InUti/OutUti: input utility rate/output utility rate
Interface                  PHY      Protocol  InUti OutUti   inErrors  outErrors
GE1/0/1                    up       down      0.01%  0.01%          0          0
GE1/0/2                    up       up        0.01%  0.01%          0          0

S-2:

复制代码
[S-2-GE1/0/1]int ge1/0/1
[S-2-GE1/0/1]undo portswitch 


[S-2]dis int brief
PHY: Physical
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
(b): BFD down
(e): ETHOAM down
(d): Dampening Suppressed
(p): port alarm down
(dl): DLDP down
(c): CFM down
(sd): STP instance discarding
(ms): MACsec down
(ed): error down
(lb): LBDT block
InUti/OutUti: input utility rate/output utility rate
Interface                  PHY      Protocol  InUti OutUti   inErrors  outErrors
GE1/0/1                    up       down      0.01%  0.01%          0          0
GE1/0/2                    up       up        0.01%  0.01%          0          0
GE1/0/3                    *down    down         0%     0%          0          0

S-3:

复制代码
[S-3]dis int brief
PHY: Physical
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
(b): BFD down
(e): ETHOAM down
(d): Dampening Suppressed
(p): port alarm down
(dl): DLDP down
(c): CFM down
(sd): STP instance discarding
(ms): MACsec down
(ed): error down
(lb): LBDT block
InUti/OutUti: input utility rate/output utility rate
Interface                  PHY      Protocol  InUti OutUti   inErrors  outErrors
GE1/0/1                    up       up        0.01%  0.01%          0          0
GE1/0/2                    up       up        0.01%  0.01%          0          0
GE1/0/3                    *down    down         0%     0%          0          0

S-4:

复制代码
[S-4]dis int brief
PHY: Physical
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
(b): BFD down
(e): ETHOAM down
(d): Dampening Suppressed
(p): port alarm down
(dl): DLDP down
(c): CFM down
(sd): STP instance discarding
(ms): MACsec down
(ed): error down
(lb): LBDT block
InUti/OutUti: input utility rate/output utility rate
Interface                  PHY      Protocol  InUti OutUti   inErrors  outErrors
GE1/0/1                    up       up        0.01%  0.01%          0          0
GE1/0/2                    up       up        0.01%  0.01%          0          0
>>RSTP端口角色

S-1:

复制代码
[S-1]dis stp brief
 MSTID  Port                        Role  STP State     Protection      Cost    Edged
     0  GE1/0/2                     DESI  forwarding    root              20    disable   
[S-1]

S-2:

复制代码
[S-2]dis stp brief
 MSTID  Port                        Role  STP State     Protection      Cost    Edged
     0  GE1/0/2                     ROOT  forwarding    none              20    disable   
[S-2]

S-3:

复制代码
[S-3]dis stp brief
 MSTID  Port                        Role  STP State     Protection      Cost    Edged
     0  GE1/0/1                     ROOT  forwarding    none              20    disable   
     0  GE1/0/2                     DESI  forwarding    none           20000    disable   
[S-3]

S-4:

复制代码
[S-4]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   
[S-4]

------步骤二:相关端口执行portswitch,并进行抓包

先在 S-2 上将 GE1/0/1 设为 portswitch(使其参与 RSTP),再在 S-1 上将 GE1/0/1 设为 portswitch(使其参与RSTP)

同时在 S-1 的两个端口(GE1/0/1、GE1/0/2)与 S-3 的两个端口(GE1/0/1、GE1/0/2)分别抓包(共有 4 个抓包文件)。

最终RSTP状态为:

以下为各抓包文件分析。

3.5.3 抓包分析报告(一):S-1 ⇄ S-2 链路 RSTP 工作机制分析

抓包接口: S-1 的 GE1/0/1
对应设备:

  • S-1(fa:e8:d2:bf:00:11)

  • S-2(fa:e8:d2:bf:00:21)

抓包时间: 2025-10-27 15:44:31 ~ 15:45:10

------一、实验背景

在本阶段,S-2 的端口重新启用(执行 portswitch),开始重新参与 RSTP 拓扑计算。

由于启用顺序为 "先启用 S-2,再启用 S-1" ,因此在最初时刻,S-2 无法直接从 S-1 收到 BPDU,而是首先从设备 S-3 接收到携带 Root ID = fa:e8:d2:bf:00:11 的 BPDU。

通过该 BPDU,S-2 立即确认:

  • 网络中已有 Root Bridge(即 S-1);

  • 自身并非根桥,应作为非根设备参与收敛。

------二、帧序列总体概览

帧号 时间 源 MAC Flags 说明
13--20 15:44:31--15:44:34 S-2 0x4E Proposal + Agreement,发起握手
22 15:44:34.409 S-1 0x4E Root Bridge 回复 Proposal
25 15:44:34.456 S-2 0x48 Root Port 确认,进入 Discarding
26 15:44:34.459 S-2 0x79 Root Port → Forwarding,带 TC 标志
27 15:44:34.471 S-1 0x4D 同步收到 TC 标志,继续转发 TC 通告
33--35 15:44:36 左右 双方 0x79/0x7D 转入 Forwarding 状态,收敛完成
40 以后 每 2 秒 S-1 0x7C 稳定 Hello BPDU,维持同步

------三、关键阶段分析

🕓 阶段 ①:Proposal 发起阶段
复制代码
Frame 13: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:21
    Length: 39
    Padding: 00000000000000
    [Stream index: 6]
Logical-Link Control
Spanning Tree Protocol
    Protocol Identifier: Spanning Tree Protocol (0x0000)
    Protocol Version Identifier: Rapid Spanning Tree (2)
    BPDU Type: Rapid/Multiple Spanning Tree (0x02)
    BPDU flags: 0x4e, Agreement, Port Role: Designated, Proposal
        0... .... = Topology Change Acknowledgment: No
        .1.. .... = Agreement: Yes
        ..0. .... = Forwarding: No
        ...0 .... = Learning: No
        .... 11.. = Port Role: Designated (3)
        .... ..1. = Proposal: Yes
        .... ...0 = Topology Change: No
    Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 60
    Bridge Identifier: 4096 / 0 / fa:e8:d2:bf:00:21
    Port identifier: 0x8001
    Message Age: 3
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0
  • Frame 13--20 均由 S-2 发送,Flags = 0x4E

    • Port Role = Designated

    • Proposal = 1

    • Forwarding/Learning = 0

    • Agreement = 1

  • 含义:

    S-2 的端口在启动后向上游(S-1)发送 Proposal BPDU,请求建立同步关系,表示:

    "我已检测到更优根桥路径(Root = S-1),希望立即同步拓扑状态。"

此时 Root Path Cost=60,表明 S-2 仍在计算最优路径。

🕓 阶段 ②:Root Bridge 响应 Proposal
复制代码
Frame 22: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:11
    Length: 39
    Padding: 00000000000000
    [Stream index: 9]
Logical-Link Control
Spanning Tree Protocol
    Protocol Identifier: Spanning Tree Protocol (0x0000)
    Protocol Version Identifier: Rapid Spanning Tree (2)
    BPDU Type: Rapid/Multiple Spanning Tree (0x02)
    BPDU flags: 0x4e, Agreement, Port Role: Designated, Proposal
        0... .... = Topology Change Acknowledgment: No
        .1.. .... = Agreement: Yes
        ..0. .... = Forwarding: No
        ...0 .... = Learning: No
        .... 11.. = Port Role: Designated (3)
        .... ..1. = Proposal: Yes
        .... ...0 = Topology Change: No
    Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 0
    Bridge Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Port identifier: 0x8001
    Message Age: 0
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0
  • Frame 22(来自 S-1,Flags = 0x4E)

    • S-1 作为 Root Bridge,同样发送带 Proposal 的 BPDU;

    • 表示自己是 Designated Port,并要求下游(S-2)同步。

此处的"Proposal 对 Proposal"现象常见于端口刚加入且双方几乎同时进行角色确认时,

属于 IEEE 802.1D-2004 中的合法交互:即 双方端口互相检测为 Designated,需通过 Agreement 决定方向性

你提到:此处的"Proposal 对 Proposal"现象常见于端口刚加入且双方几乎同时进行角色确认时, 属于 IEEE 802.1D-2004 中的合法交互:即 双方端口互相检测为 Designated,需通过 Agreement 决定方向性。这个具体是怎么说明的?

ChatGPT 说:

非常好的问题,这其实触及到 RSTP(IEEE 802.1D-2004)里最容易被误解、但也是最关键的机制之一------
双向 Proposal/Agreement(即双方都发 Proposal)时,如何达成一致。

我来给你做一个完整、标准依据级别的说明👇


🔹 一、先回顾 Proposal/Agreement 的基本逻辑

在 RSTP(802.1D-2004 Clause 17.3 和 17.19.14)中:

  • 当一个端口认为自己是 Designated Port (即它在某段链路上拥有更优 BPDU)时,

    它会向对端发送一个 带 Proposal=1 的 BPDU

  • 对端收到 Proposal 后,必须:

    1. 阻塞除这条链路外的所有非 Edge 端口;

    2. 若该端口根据 BPDU 判断自己应处于 Root Port,则立刻回一个 带 Agreement=1 的 BPDU;

    3. 双方即可进入同步状态,Designated Port 进入 Forwarding。

因此,正常的单向交互是:

Designated → Proposal → 对端(Root Port) → Agreement → Forwarding。


🔹 二、特殊情况:双方几乎同时发 Proposal

IEEE 802.1D-2004 第 17.19.14 节指出:

"If both bridges on a point-to-point link transmit a Proposal,

both will recognize that the other bridge is Designated for that port.

Each bridge will then determine which of them should remain Designated,

according to the spanning tree priority rules."

也就是说:

  • 当双方同时成为 Designated 并都发送 Proposal=1 的 BPDU 时,

    双方都会认为"对端是 Designated",这违反了 STP 的唯一性(同一段链路只能有一个 Designated)。

  • 为了解决这一冲突,双方必须重新比较其 BPDU 优先级字段(Root ID → Root Path Cost → Bridge ID → Port ID)。

  • 比较结果决定:

    • 优先级高的一方 继续保持 Designated 角色;

    • 优先级低的一方 转为 Root Port,并以 Agreement=1 响应;

    • 最终链路方向性确立。

这一过程是"Proposal 对 Proposal"情形下的标准解决方案。


🔹 三、报文级体现

在抓包中,如果你看到:

方向 BPDU flags 含义
A → B 0x4E(Proposal=1, Designated) A 发出 Proposal
B → A 0x4E(Proposal=1, Designated) B 几乎同时也发出 Proposal
A → B 0x7C(Agreement=1, Forwarding) A 判断自己胜出(Designated)
B → A 0x49(Agreement=1, Root) B 认定对方为 Designated,自身为 Root Port

这个时序就是标准文档所述的"双向 Proposal"冲突与协商。


🔹 四、标准条文出处(IEEE 802.1D-2004)

  • Clause 17.3 -- RSTP Port Role Transitions

    "Each designated port transmits a Proposal.

    When both ends of a point-to-point link transmit a Proposal,

    the spanning tree priority comparison determines which port remains Designated."

  • Clause 17.19.14 -- Synchronization and Proposal/Acknowledgment Handshake

    "If both bridges transmit Proposals,

    each will receive the other's Proposal and perform a comparison of the received and transmitted information.

    The bridge whose information is superior retains the Designated role; the other agrees."


🔹 五、总结一句话

"Proposal 对 Proposal" 不是异常现象,而是标准定义的合法过渡态。

双方都暂时认为自己是 Designated,通过 BPDU 优先级比较决定方向。

胜出的一方保持 Designated;

另一方设置 Agreement=1 表示"我接受你的方向",随后进入同步转发。

🕓 阶段 ③:S-2 端口确认并进入 Root 角色
复制代码
Frame 25: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:21
    Length: 39
    Padding: 00000000000000
    [Stream index: 6]
Logical-Link Control
Spanning Tree Protocol
    Protocol Identifier: Spanning Tree Protocol (0x0000)
    Protocol Version Identifier: Rapid Spanning Tree (2)
    BPDU Type: Rapid/Multiple Spanning Tree (0x02)
    BPDU flags: 0x48, Agreement, Port Role: Root
        0... .... = Topology Change Acknowledgment: No
        .1.. .... = Agreement: Yes
        ..0. .... = Forwarding: No
        ...0 .... = Learning: No
        .... 10.. = Port Role: Root (2)
        .... ..0. = Proposal: No
        .... ...0 = Topology Change: No
    Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 20
    Bridge Identifier: 4096 / 0 / fa:e8:d2:bf:00:21
    Port identifier: 0x8001
    Message Age: 0
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0
  • Frame 25(S-2 → S-1,Flags = 0x48)

    • Port Role = Root(2)

    • Forwarding/Learning = 0

    • Agreement = 1

      → 表示 S-2 已确定自身为 Root Port,准备进入同步阶段。

      Frame 26: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
      IEEE 802.3 Ethernet
      Destination: 01:80:c2:00:00:00
      Source: fa:e8:d2:bf:00:21
      Length: 39
      Padding: 00000000000000
      [Stream index: 6]
      Logical-Link Control
      Spanning Tree Protocol
      Protocol Identifier: Spanning Tree Protocol (0x0000)
      Protocol Version Identifier: Rapid Spanning Tree (2)
      BPDU Type: Rapid/Multiple Spanning Tree (0x02)
      BPDU flags: 0x79, Agreement, Forwarding, Learning, Port Role: Root, Topology Change
      0... .... = Topology Change Acknowledgment: No
      .1.. .... = Agreement: Yes
      ..1. .... = Forwarding: Yes
      ...1 .... = Learning: Yes
      .... 10.. = Port Role: Root (2)
      .... ..0. = Proposal: No
      .... ...1 = Topology Change: Yes
      Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
      Root Path Cost: 20
      Bridge Identifier: 4096 / 0 / fa:e8:d2:bf:00:21
      Port identifier: 0x8001
      Message Age: 0
      Max Age: 20
      Hello Time: 2
      Forward Delay: 15
      Version 1 Length: 0

  • Frame 26(S-2 → S-1,Flags = 0x79)

    • Forwarding + Learning + TC = 1

      → 表示 S-2 的 Root Port 已进入 Forwarding 状态,并开始拓扑变化(TC)通告。

此处即是 Proposal/Agreement 成功完成的瞬间:
S-1 为 Designated Port,S-2 为 Root Port

两者之间链路成为稳定的"根桥上行路径"。

🕓 阶段 ④:拓扑变化(TC)通告
复制代码
Frame 27: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:11
    Length: 39
    Padding: 00000000000000
    [Stream index: 9]
Logical-Link Control
Spanning Tree Protocol
    Protocol Identifier: Spanning Tree Protocol (0x0000)
    Protocol Version Identifier: Rapid Spanning Tree (2)
    BPDU Type: Rapid/Multiple Spanning Tree (0x02)
    BPDU flags: 0x4d, Agreement, Port Role: Designated, Topology Change
        0... .... = Topology Change Acknowledgment: No
        .1.. .... = Agreement: Yes
        ..0. .... = Forwarding: No
        ...0 .... = Learning: No
        .... 11.. = Port Role: Designated (3)
        .... ..0. = Proposal: No
        .... ...1 = Topology Change: Yes
    Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 0
    Bridge Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Port identifier: 0x8001
    Message Age: 0
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0
  • Frame 27(S-1) :Flags = 0x4D(Designated + TC)

    S-1 接收到 TC 标志后,也在其 Hello BPDU 中携带 TC=1,继续向其他端口传播拓扑变化信息。

    Frame 33: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
    IEEE 802.3 Ethernet
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:11
    Length: 39
    Padding: 00000000000000
    [Stream index: 9]
    Logical-Link Control
    Spanning Tree Protocol
    Protocol Identifier: Spanning Tree Protocol (0x0000)
    Protocol Version Identifier: Rapid Spanning Tree (2)
    BPDU Type: Rapid/Multiple Spanning Tree (0x02)
    BPDU flags: 0x7d, Agreement, Forwarding, Learning, Port Role: Designated, Topology Change
    0... .... = Topology Change Acknowledgment: No
    .1.. .... = Agreement: Yes
    ..1. .... = Forwarding: Yes
    ...1 .... = Learning: Yes
    .... 11.. = Port Role: Designated (3)
    .... ..0. = Proposal: No
    .... ...1 = Topology Change: Yes
    Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 0
    Bridge Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Port identifier: 0x8001
    Message Age: 0
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0

    Frame 34: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
    IEEE 802.3 Ethernet
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:21
    Length: 39
    Padding: 00000000000000
    [Stream index: 6]
    Logical-Link Control
    Spanning Tree Protocol
    Protocol Identifier: Spanning Tree Protocol (0x0000)
    Protocol Version Identifier: Rapid Spanning Tree (2)
    BPDU Type: Rapid/Multiple Spanning Tree (0x02)
    BPDU flags: 0x79, Agreement, Forwarding, Learning, Port Role: Root, Topology Change
    0... .... = Topology Change Acknowledgment: No
    .1.. .... = Agreement: Yes
    ..1. .... = Forwarding: Yes
    ...1 .... = Learning: Yes
    .... 10.. = Port Role: Root (2)
    .... ..0. = Proposal: No
    .... ...1 = Topology Change: Yes
    Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 20
    Bridge Identifier: 4096 / 0 / fa:e8:d2:bf:00:21
    Port identifier: 0x8001
    Message Age: 0
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0

  • Frame 33--34(S-1 与 S-2)

    • S-1 发送 0x7D(TC 仍有效,Forwarding 状态)

    • S-2 发送 0x79(Root 端口稳定,继续转发 TC)

此阶段 BPDU 中的 Root Identifier 一致为 fa:e8:d2:bf:00:11,表明全网已统一根桥。

🕓 阶段 ⑤:稳定收敛阶段
复制代码
Frame 35: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:11
    Length: 39
    Padding: 00000000000000
    [Stream index: 9]
Logical-Link Control
Spanning Tree Protocol
    Protocol Identifier: Spanning Tree Protocol (0x0000)
    Protocol Version Identifier: Rapid Spanning Tree (2)
    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: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 0
    Bridge Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Port identifier: 0x8001
    Message Age: 0
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0
  • Frame 35 及之后(S-1 → S-2) :Flags = 0x7C

    表示端口状态已进入 Forwarding,Agreement=1 持续维持同步关系;

    此时网络处于正常 Hello BPDU 周期状态(每 2 秒)。

  • 所有后续 BPDU(Frame 40~86)均显示相同 Flags 与 Root 信息,

    网络完全收敛,RSTP 同步状态稳定。

------四、协议字段汇总

字段 取值 含义
Root Bridge fa:e8:d2:bf:00:11(S-1) 全网根桥
Root Path Cost(S-2) 从 60 → 20 说明路径收敛、层级明确
Port Role(S-1) Designated 上行端口主动转发
Port Role(S-2) Root 作为根端口接收 BPDU
Agreement 全程为 1 表示双方已同步状态
Proposal 仅握手阶段为 1 触发同步请求
TC 位 临时置 1 两次 Hello 时间 通知拓扑更新

3.5.4 抓包分析报告(二):S-2 ⇄ S-3 链路 RSTP 工作机制分析

抓包接口: S-3 的 GE1/0/2
对应设备:

  • S-2(fa:e8:d2:bf:00:21)

  • S-3(fa:e8:d2:bf:00:31)
    抓包时间: 2025-10-27 15:44:28 ~ 15:45:15

------一、实验背景

本实验阶段 S-2 端口重新启用(portswitch),重新参与 RSTP 拓扑。

由于上游 S-1 与 S-2 之间的链路恢复,网络拓扑结构发生变化,S-2 需重新与 S-3 进行 Proposal/Agreement 协商以重新确定端口角色。

S-3 的 GE1/0/2 端口抓包记录了整个协商与收敛过程。

------二、帧序列总体概览

时间段 发送方 Flags 值 含义 状态说明
Frame 2--9 S-3 → S-2 0x7C Agreement + Forwarding + Learning S-3 稳定 Designated Port 状态
Frame 12 S-2 → S-3 0x7E Agreement + Proposal + Forwarding + Learning S-2 发送 Proposal,开始握手
Frame 13 S-3 → S-2 0x44 Agreement + Alternate Port S-3 回复 Agreement,但自身端口进入 Alternate(阻塞)
Frame 14 S-2 → S-3 0x4F Agreement + Proposal + TC S-2 确认拓扑变化并广播 TC
Frame 15 S-3 → S-2 0x44 再次确认 Alternate 保持阻塞
Frame 16--19 S-2 → S-3 0x7D Agreement + Forwarding + Learning + TC 拓扑变化处理完毕,恢复稳定
Frame 21+ S-2 → S-3 0x7C 正常 Hello BPDU,稳定转发状态

------三、关键阶段分析

⏱ 1️⃣ 初始阶段(Frame 2--9, 15:44:28--15:44:32)
复制代码
Frame 2: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:31
    Length: 39
    Padding: 00000000000000
    [Stream index: 1]
Logical-Link Control
Spanning Tree Protocol
    Protocol Identifier: Spanning Tree Protocol (0x0000)
    Protocol Version Identifier: Rapid Spanning Tree (2)
    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: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 40
    Bridge Identifier: 32768 / 0 / fa:e8:d2:bf:00:31
    Port identifier: 0x8002
    Message Age: 2
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0
  • 发送方: S-3

  • Flags: 0x7C

  • 含义:

    • Port Role = Designated

    • Forwarding + Learning + Agreement

  • 说明:

    S-3 在该阶段仍认为自己是下行链路的 Designated Port,向 S-2 周期发送 RSTP BPDU,Hello Time = 2s。

    此时网络尚未检测到新的上游路径。

⏱ 2️⃣ Proposal 发起阶段(Frame 12,15:44:34.43)
复制代码
Frame 12: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:21
    Length: 39
    Padding: 00000000000000
    [Stream index: 7]
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: Rapid Spanning Tree (2)
    BPDU Type: Rapid/Multiple Spanning Tree (0x02)
    BPDU flags: 0x7e, Agreement, Forwarding, Learning, Port Role: Designated, Proposal
        0... .... = Topology Change Acknowledgment: No
        .1.. .... = Agreement: Yes
        ..1. .... = Forwarding: Yes
        ...1 .... = Learning: Yes
        .... 11.. = Port Role: Designated (3)
        .... ..1. = Proposal: Yes
        .... ...0 = Topology Change: No
    Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 20
    Bridge Identifier: 4096 / 0 / fa:e8:d2:bf:00:21
    Port identifier: 0x8002
    Message Age: 1
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0
  • 发送方: S-2(fa:e8:d2:bf:00:21)

  • Flags: 0x7E(Agreement + Forwarding + Learning + Proposal)

  • 含义:

    • 表示 S-2 向 S-3 发起 Proposal,建议自己为 Designated Port;

    • 同时表明其已处于 Forwarding 状态(说明上游握手已完成)。

  • 说明:

    S-2 端口启用后检测到上游 S-1 是根桥(Root Bridge = fa:e8:d2:bf:00:11),

    其自身成为距离根路径较短的交换机,因此主动向 S-3 发起 Proposal,通知 S-3:

    "我(S-2)路径更优,应为 Designated,你需同步阻塞非 Edge 端口。"

⏱ 3️⃣ 同步与回应阶段(Frame 13--15,15:44:34.46)
复制代码
Frame 13: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:31
    Length: 39
    Padding: 00000000000000
    [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: Rapid Spanning Tree (2)
    BPDU Type: Rapid/Multiple Spanning Tree (0x02)
    BPDU flags: 0x44, Agreement, Port Role: Alternate or Backup
        0... .... = Topology Change Acknowledgment: No
        .1.. .... = Agreement: Yes
        ..0. .... = Forwarding: No
        ...0 .... = Learning: No
        .... 01.. = Port Role: Alternate or Backup (1)
        .... ..0. = Proposal: No
        .... ...0 = Topology Change: No
    Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 40
    Bridge Identifier: 32768 / 0 / fa:e8:d2:bf:00:31
    Port identifier: 0x8002
    Message Age: 1
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0
  • Frame 13: S-3 回复 0x44(Agreement + Alternate)

    • 表示同意 S-2 的 Proposal;

    • 自身端口角色从 Designated 变为 Alternate(备用端口),停止转发。

    • 此时同步过程完成,防止形成环路。

      Frame 14: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
      IEEE 802.3 Ethernet
      Destination: 01:80:c2:00:00:00
      Source: fa:e8:d2:bf:00:21
      Length: 39
      Padding: 00000000000000
      [Stream index: 7]
      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: Rapid Spanning Tree (2)
      BPDU Type: Rapid/Multiple Spanning Tree (0x02)
      BPDU flags: 0x4f, Agreement, Port Role: Designated, Proposal, Topology Change
      0... .... = Topology Change Acknowledgment: No
      .1.. .... = Agreement: Yes
      ..0. .... = Forwarding: No
      ...0 .... = Learning: No
      .... 11.. = Port Role: Designated (3)
      .... ..1. = Proposal: Yes
      .... ...1 = Topology Change: Yes
      Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
      Root Path Cost: 20
      Bridge Identifier: 4096 / 0 / fa:e8:d2:bf:00:21
      Port identifier: 0x8002
      Message Age: 1
      Max Age: 20
      Hello Time: 2
      Forward Delay: 15
      Version 1 Length: 0

  • Frame 14: S-2 再次发送 0x4F(Agreement + Proposal + Topology Change)

    • 表明 S-2 已收到 S-3 的 Agreement,

    • 同时通告网络发生拓扑变化(TC=1),触发 MAC 表老化。

      Frame 15: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
      IEEE 802.3 Ethernet
      Destination: 01:80:c2:00:00:00
      Source: fa:e8:d2:bf:00:31
      Length: 39
      Padding: 00000000000000
      [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: Rapid Spanning Tree (2)
      BPDU Type: Rapid/Multiple Spanning Tree (0x02)
      BPDU flags: 0x44, Agreement, Port Role: Alternate or Backup
      0... .... = Topology Change Acknowledgment: No
      .1.. .... = Agreement: Yes
      ..0. .... = Forwarding: No
      ...0 .... = Learning: No
      .... 01.. = Port Role: Alternate or Backup (1)
      .... ..0. = Proposal: No
      .... ...0 = Topology Change: No
      Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
      Root Path Cost: 40
      Bridge Identifier: 32768 / 0 / fa:e8:d2:bf:00:31
      Port identifier: 0x8002
      Message Age: 1
      Max Age: 20
      Hello Time: 2
      Forward Delay: 15
      Version 1 Length: 0

Frame 15(S-3 → S-2,flags = 0x44 --- Agreement + Alternate)

S-3 回复一帧与 Frame 13 相同标志位的 BPDU,表示它已完成同步过程并维持 Alternate 端口状态。此时该端口不再转发用户流量,仅保留监听 BPDUs,以便后续检测链路变化。

该帧未携带 TC 标志,说明网络已进入稳定的同步阶段,无需继续通告拓扑变更。

⏱ 4️⃣ 拓扑变化通告阶段(Frame 16--19)
复制代码
Frame 16: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:21
    Length: 39
    Padding: 00000000000000
    [Stream index: 7]
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: Rapid Spanning Tree (2)
    BPDU Type: Rapid/Multiple Spanning Tree (0x02)
    BPDU flags: 0x7d, Agreement, Forwarding, Learning, Port Role: Designated, Topology Change
        0... .... = Topology Change Acknowledgment: No
        .1.. .... = Agreement: Yes
        ..1. .... = Forwarding: Yes
        ...1 .... = Learning: Yes
        .... 11.. = Port Role: Designated (3)
        .... ..0. = Proposal: No
        .... ...1 = Topology Change: Yes
    Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 20
    Bridge Identifier: 4096 / 0 / fa:e8:d2:bf:00:21
    Port identifier: 0x8002
    Message Age: 1
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0
  • 发送方: S-2

  • Flags: 0x7D(Agreement + Forwarding + Learning + TC)

  • 含义:

    S-2 在完成握手后继续发送 TC=1 的 BPDU 两次 Hello Time,

    通知下游设备刷新转发表,符合 IEEE 802.1D-2004 的规定。

⏱ 5️⃣ 稳定收敛阶段(Frame 21--73)
复制代码
Frame 21: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:21
    Length: 39
    Padding: 00000000000000
    [Stream index: 7]
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: Rapid Spanning Tree (2)
    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: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 20
    Bridge Identifier: 4096 / 0 / fa:e8:d2:bf:00:21
    Port identifier: 0x8002
    Message Age: 1
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0
  • 发送方: S-2

  • Flags: 0x7C(Agreement + Forwarding + Learning)

  • 说明:

    网络收敛完成,S-2 的端口成为 Designated Port,S-3 的端口为 Alternate Port;

    之后定期发送正常 Hello BPDU,维持同步状态。

------四、协议字段分析摘要

字段 说明
Root Identifier fa:e8:d2:bf:00:11 (S-1) 全网根桥
Root Path Cost (S-2) 20 上游距离
Root Path Cost (S-3) 40 下游更长路径
Port Role (S-2) Designated 向下转发
Port Role (S-3) Alternate 被动阻塞
Hello Time 2s 周期一致
TC 标志 临时置 1 通告拓扑变化

------五、过程总结与技术结论

阶段 动作 说明
1️⃣ S-2 启动 检测到自身路径更优 发起 Proposal
2️⃣ S-3 同步 阻塞非 Edge 端口 回复 Agreement
3️⃣ S-2 接收 端口进入 Forwarding 发 TC 通告
4️⃣ RSTP 网络同步 所有下游更新 MAC 表刷新
5️⃣ 收敛完成 周期发送 Hello BPDU Flags=0x7C 稳定

结论:

  • 本抓包完整展示了 Proposal / Agreement 握手 + TC 通告 + 快速收敛 全流程;

  • 握手期间仅耗时约 700ms,比标准 STP 的 30s 快约 40 倍;

  • S-3 端口被动进入 Alternate,S-2 成为稳定 Designated;

  • 协议标志变化符合 IEEE 802.1D-2004 RSTP 行为定义。

3.5.5 抓包分析报告(三):S-1 ⇄ S-4 链路 RSTP 工作机制分析

抓包接口: S-1 GE1/0/2
对应设备:

  • 上游:S-1(fa:e8:d2:bf:00:11)

  • 下游:S-4(非根交换机)
    抓包时间: 2025-10-27 15:44:17 ~ 15:45:07

------一、实验背景

S-1 为整网 Root Bridge,GE1/0/2 为其下行 Designated 端口。

在前一阶段,S-1 与 S-2 的 GE1/0/1 端口刚完成 Proposal/Agreement,同步拓扑变化(TC)。

因此 GE1/0/2 上可观察到:

  • RSTP 正常 Hello 周期(每 2 秒);

  • 在 15:44:34.472(Frame 26)处,BPDU 中出现 Topology Change 标志位 (TC=1)

    表示 S-1 收到上游 TC 通知后向下游传播拓扑变化;

  • 随后恢复为正常 Hello BPDU。

------二、BPDU 序列特征

时间(约) 帧号 Flags 说明
15:44:17--15:44:31 Frame 1--22 0x7C 正常 Hello BPDU,Designated 状态
15:44:34.472 Frame 26 0x7D (TC=1) 收到拓扑变化,S-1 开始通告
15:44:35.163~15:44:36.207 Frame 27、31、33 0x7D 持续 TC 通告(3 次)
15:44:37.200 起 Frame 37 起 0x7C 恢复正常 Hello,网络稳定
之后每 2 秒发送一次 Frame 37~77 0x7C 周期性 BPDU,维持拓扑

Frame 1(0x7C,Frame 1--22相同):

复制代码
Frame 1: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
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: Rapid Spanning Tree (2)
    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: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 0
    Bridge Identifier: 0 / 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

Frame 26(**0x7D (TC=1),**Frame 27、31、33相同):

复制代码
Frame 26: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
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: Rapid Spanning Tree (2)
    BPDU Type: Rapid/Multiple Spanning Tree (0x02)
    BPDU flags: 0x7d, Agreement, Forwarding, Learning, Port Role: Designated, Topology Change
        0... .... = Topology Change Acknowledgment: No
        .1.. .... = Agreement: Yes
        ..1. .... = Forwarding: Yes
        ...1 .... = Learning: Yes
        .... 11.. = Port Role: Designated (3)
        .... ..0. = Proposal: No
        .... ...1 = Topology Change: Yes
    Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 0
    Bridge Identifier: 0 / 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

Frame 37(0x7C,Frame 37--77相同):

复制代码
Frame 37: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet 
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: Rapid Spanning Tree (2)
    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: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 0
    Bridge Identifier: 0 / 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

------三、关键字段解析

字段 取值 说明
Root Identifier fa:e8:d2:bf:00:11 Root Bridge 为 S-1
Root Path Cost 0 自身为根桥
Bridge ID fa:e8:d2:bf:00:11 与 Root ID 相同,确认其 Root 角色
Port Role Designated (3) 该端口向下游发送 BPDU
Flags 0x7C(正常)/0x7D(带 TC) 标识拓扑变化状态
Hello Time 2 s Hello 间隔
Max Age 20 s 超时老化时间
Forward Delay 15 s 与标准值一致

------四、事件时间线(重点)

时间 事件描述
15:44:17 -- 15:44:31 S-1 以 Root 身份发送正常 Hello BPDU,Flags=0x7C
15:44:34.47(Frame 26) 收到来自上游(S-2)的 TC 报文后,S-1 在此端口设置 TC=1,传播拓扑变化
15:44:35--15:44:36 连续三帧(27/31/33)携带 TC 标志,确保下游同步更新转发表
15:44:37.20 之后 TC 位清零,Flags 恢复为 0x7C,说明拓扑收敛完毕
15:44:37--15:45:07 每 2 秒 Hello BPDU 正常,RSTP 状态稳定

------五、拓扑变化传播机制分析

拓扑变化原因:

上游 S-2 在重新参与 RSTP 时,其 Root Port 进入 Forwarding,并向 Root Bridge (S-1) 发送 TC=1 报文。

S-1 的行为:

  1. 收到 TC 位 → 在自己的下行端口 GE1/0/2 中也设置 TC=1;

  2. 向所有 Designated 端口转发该 TC 标志;

  3. 通知下游设备刷新 MAC 地址表,防止转发旧路径数据;

  4. 在约 4 秒内恢复为正常 Hello。

体现的 RSTP 特征:

  • TC 通告是双向快速传播的;

"双向" 指的是 TC 信息不仅向下(远离根桥)传播,也向上(朝向根桥)传播,并且所有收到的交换机都会继续向所有方向泛洪。

  • 仅持续 2~3 个 Hello 周期,极大减少拓扑变化影响范围;

  • 收敛完成后立即恢复到稳定状态。

3.5.6 抓包分析报告(四):S-3 ⇄ S-4 链路 RSTP 工作机制分析

抓包接口: S-3 的 GE1/0/1
对应设备:

  • S-3(fa:e8:d2:bf:00:31)

  • S-4(fa:e8:d2:bf:00:41)
    抓包时间: 2025-10-27 15:44:27 ~ 15:45:13

------一、总体观察

在整个抓包周期中,所有 BPDU 均由 S-4(fa:e8:d2:bf:00:41)发出 ,S-3 处于监听状态。

这表明在该链路中,S-4 的端口为 Designated Port(指定端口) ,而 S-3 的对应端口为 Root Port(根端口)

从 BPDU 的标志位(Flags)中可以看出:

时间段 Flags 值 含义 状态变化
Frame 2~11 0x7C Agreement=1, Forwarding=1, Learning=1, Role=Designated 稳定工作状态(Forwarding)
Frame 14~22 0x7D 在 0x7C 基础上新增 Topology Change=1 检测到拓扑变化(TC)
Frame 25~76 回到 0x7C 进入新的稳定状态

------二、协议字段细节解析

1️⃣ Flags 字节(BPDU Flags)

在 RSTP 中,Flags 八位字段用于编码端口角色和状态。

以下是关键位的解释:

含义 说明
bit7 Topology Change Acknowledgment (TCA) 此处始终为 0
bit6 Agreement =1 表示已完成 Proposal/Agreement
bit5 Forwarding =1 表示端口处于转发状态
bit4 Learning =1 表示端口可学习 MAC
bit3-2 Port Role =11 表示 Designated
bit1 Proposal 仅在最初握手时置 1
bit0 Topology Change (TC) 当检测到拓扑变化时置 1

结合抓包结果:

  • 初始阶段 (Frame 2~11)

    Frame 2: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
    IEEE 802.3 Ethernet
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:41
    Length: 39
    Padding: 00000000000000
    [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: Rapid Spanning Tree (2)
    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: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 20
    Bridge Identifier: 32768 / 0 / fa:e8:d2:bf:00:41
    Port identifier: 0x8001
    Message Age: 1
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0

0x7C = 0111 1100

表明:

  • 该端口处于 Forwarding 状态;

  • 已与对端完成 Agreement;

  • 当前角色为 Designated。

  • 拓扑变化阶段 (Frame 14~22)

    Frame 14: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
    IEEE 802.3 Ethernet
    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: Rapid Spanning Tree (2)
    BPDU Type: Rapid/Multiple Spanning Tree (0x02)
    BPDU flags: 0x7d, Agreement, Forwarding, Learning, Port Role: Designated, Topology Change
    0... .... = Topology Change Acknowledgment: No
    .1.. .... = Agreement: Yes
    ..1. .... = Forwarding: Yes
    ...1 .... = Learning: Yes
    .... 11.. = Port Role: Designated (3)
    .... ..0. = Proposal: No
    .... ...1 = Topology Change: Yes
    Root Identifier: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 20
    Bridge Identifier: 32768 / 0 / fa:e8:d2:bf:00:41
    Port identifier: 0x8001
    Message Age: 1
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0

0x7D = 0111 1101

在 0x7C 基础上增加了 TC 标志位,说明此时 S-4 检测到网络发生了变化(可能是上游 S-1/S-2 端口恢复后拓扑重计算引起)。

  • 稳定阶段 (Frame ≥25)

    Frame 25: Packet, 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
    IEEE 802.3 Ethernet
    Destination: 01:80:c2:00:00:00
    Source: fa:e8:d2:bf:00:41
    Length: 39
    Padding: 00000000000000
    [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: Rapid Spanning Tree (2)
    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: 0 / 0 / fa:e8:d2:bf:00:11
    Root Path Cost: 20
    Bridge Identifier: 32768 / 0 / fa:e8:d2:bf:00:41
    Port identifier: 0x8001
    Message Age: 1
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0

  • 标志恢复为 0x7C,网络重新收敛。

------三、Root 与 Bridge 信息分析

字段 说明
Root Identifier 0 / 0 / fa:e8:d2:bf:00:11 Root Bridge 是 S-1
Root Path Cost 20 从 S-4 到 S-1 的累计路径代价
Bridge Identifier 32768 / 0 / fa:e8:d2:bf:00:41 当前发送方为 S-4
Port Identifier 0x8001 S-4 的端口 1
Message Age 1 从根桥发出后的 BPDU 生命周期(跳数)

➡️ 说明:

S-4 已正确识别 S-1 为全网根桥 ,自身处于下游位置;

且其 Designated Port 将 BPDU 向下游的 S-3 持续转发。

------四、时序与拓扑变化分析

1️⃣ 15:44:27~15:44:33 (Frame 2--11)

  • S-4 定期发送 Agreement + Forwarding BPDU (0x7C),表示链路稳定。

  • BPDU 周期约 2 秒,与 Hello Time=2 完全吻合。

2️⃣ 15:44:34 (Frame 14)

  • Flags 变为 0x7DTopology Change 位被置 1

  • 表示 S-4 探测到上游网络(可能 S-1⇄S-2 链路恢复)引起的拓扑变化。

  • 根据 RSTP 标准,Designated Port 会在检测到 TC 后发送 BPDU with TC=1 持续两次 Hello Time(4秒),通知邻居刷新 MAC 表。

3️⃣ 15:44:39~15:44:41 (Frame 25--30)

  • 出现多次交替的 0x7C0x7D,表明 S-4 在进行短暂的 TC 通告后恢复正常。

4️⃣ 15:44:43~15:45:13 (Frame 32--76)

  • 所有 BPDU 恢复为 0x7C;RSTP 拓扑进入新的稳定状态。

------五、结论

(1) 端口角色确定:

  • S-4(fa:e8:d2:bf:00:41)在该链路上为 Designated Port

  • S-3 对应端口为 Root Port

(2) 握手状态:

  • 已完成 Proposal/Agreement;

  • 不再出现 Proposal=1 的 BPDU。

(3) 拓扑变化检测:

  • Frame 14~22 期间的 TC=1 说明上游拓扑发生改变;

  • 但 S-4 无需重新协商 Proposal/Agreement,RSTP 自动快速同步。

(4) 稳定收敛:

  • 从拓扑变化开始(Frame 14)到恢复稳定(Frame 25),仅约 5 秒内 完成网络同步,体现了 RSTP 的快速收敛特性。

------六、技术要点总结

  • RSTP 使用 Proposal/Agreement 机制消除 Forward Delay;

  • 在稳定状态下,Designated Port 周期发送带 Agreement=1 的 BPDU;

  • 当检测到拓扑变化(如上游端口激活或阻塞),会临时发送 TC=1 通告;

  • 收敛速度远快于传统 STP(秒级 vs. 30 秒);

  • 本链路中未观察到 Proposal 位,说明在抓包开始前握手已完成。

相关推荐
eeeasen5 小时前
FnOS(0.9.32版本) --usb无线网卡(RTL8xxxu)调试
网络
奋斗的蛋黄5 小时前
TCP 和 UDP 的核心区别:从原理到场景的全面解析
网络协议·tcp/ip·udp
Larry_Yanan5 小时前
QML学习笔记(四十七)QML与C++交互:上下文对象
c++·笔记·qt·学习·ui
Vizio<5 小时前
《模仿人类皮肤层与环层小体的社交交互机器人皮肤》2024 IEEE/ASME TMECH 论文解读
人工智能·笔记·学习·机器人·交互·触觉传感器
专家大圣5 小时前
5分钟启动标准化安卓环境:Docker-Android让模拟器配置不再踩坑
android·网络·docker·容器·内网穿透
国科安芯6 小时前
基于ASM1042通信接口芯片的两轮车充电机性能优化研究
服务器·网络·人工智能·单片机·嵌入式硬件·性能优化
koo3646 小时前
李宏毅机器学习笔记36
人工智能·笔记·机器学习
普普通通的南瓜6 小时前
金融交易防护:国密 SSL 证书在网银与移动支付中的核心作用
网络·网络协议·安全·arcgis·gitlab·ssl·源代码管理
WaibiJiangzhi6 小时前
《动手学深度学习》学习笔记——02深度学习介绍
笔记·学习