首页 > 代码库 > STP 5 - Rapid STP 和 Rapid PVST (快速生成树协议)
STP 5 - Rapid STP 和 Rapid PVST (快速生成树协议)
RSTP = 802.1w
注意要点:
- 快速收敛是基于交换机相关进程同步
开启命令:
- spanning tree mode mst
- spanning tree mode rapid-pvst
- 同步进程只发生在p2p & non-edge 端口上 (p2p意味着full duplex,non-edge要有收bpdu,edge port上要配置portfast命令)
注:如果在edge端口没有配置portfast且端口是full duplex,当主机收到Rapid STP proposal时不会回复agree,这样该端口就会自动回降到normal STP 或者PVST。我们就收不到快速收敛的效果了。在mst中Rapid STP默认开启,但是如果不在edge port上配置portfast,一样要通过正常的STP进程。
- spanning-tree link-type 【point-to-point | shared】
- spanning-tree portfast
- RSTP BPDU和STP的BPDU可以同时存在 (RSTP的BPDU是v2)
- RSTP里用802.1d的BPDU向下兼容(在不支持RSTP设备上run STP)
- RSTP里每个交换机都向邻居发送BPDU包,间隔就是Hello interval (默认2s)而STP里switch要等待根桥的BPDU然后再转发
- RSTP拓扑里邻居交换机有三个BPDU包收不到就视为连接断路(相当于6s,但是在STP里MAX age是20s)
- RSTP同步进程的几个步骤 (翻译的思科文档)
1. If the proposal’s sender has a superior BPDU, the local switch realizes that the sender
should be the designated switch (having the designated port) and that its own port
must become the new root port.
如果发送请求的交换机有上级BPDU,则本地的交换机会认定发送者为designated交换机(有designated port)。本地交换机自己的端口就设定为root port
2. Before the switch agrees to anything, it must synchronize itself with the topology.
在同意任何请求之前,交换机会先和已有的拓扑进行同步(根桥,根端口,各种数据都match)
3. All nonedge ports imme diately are moved into the Discarding (blocking) state so that
no bridging loops can form.
所有的非边界端口(非直连主机)都直接进入Discarding状态,以确保没有环路产生
4. An agreement message (a configuration BPDU) is sent back to the sender, indicating
that the switch is in agreement with the new designated port choice. This also tells the
sender that the switch is in the process of synchronizing itself.
然后,同意信息(一个附带配置的BPDU包)会被送回到发送方,告诉对方交换机本地同意选择你的端口作为新的designated端口。同时,这也意味着本地交换机正在与拓扑同步
5. The root port immediately is moved to the Forwarding state. The sender’s port also
immediately can begin forwarding.
于是,root端口立即转为Forwarding状态。发送方交换机的端口也可以开始收发。
6. For each nonedge port that is currently in the Discarding state, a proposal message is
sent to the respective neighbor.
对于本地交换机的非边界端口,本身处于Discarding状态,这时会发送请求信息到他们互联的邻居。
(以下以此类推)
7. An agreement message is expected and received from a neighbor on a nonedge port.
8. The nonedge port immediately is moved to the Forwarding state.