Switch Spanning Tree Technology

Please

STP role:

阻塞端口,
备份链路

STP attributes:

桥ID,BID:16位桥优先级+48位mac,0-65535,默认32768
端口开销RPC=到达根桥路径上所有接受BPDU端口的端口开销总和,
            (BPDU入方向端口)。
            带宽高,开销小。
            根桥路径开销0
端口ID,PID:端口优先级(0-240,步长16,默认128)+端口号
            用来确定端口角色

STP operation:

Election root bridge: according to BID

选举根端口:(非根交换机)


For example, SWB G0 / 0/1 and G0 /
0/2 G0 / 0/1 SWA G0 / 0 / 1-> SWB G0 / 0/1 with an overhead of G0 / 0/1 20000
G0 / 0/2 SWA G0 / 0 / 2-> SWC G0 / 0 / 1-> SWB G0 / 0/2 overhead = 20000 * 2
Note: Port overhead is calculated in the direction

选举指定端口:(每个网段)


Block non-root non-designated ports

Port state transition


When the switch is first turned on, it is in the Blocking state. When it is elected as the root port or a designated port, it enters Listening. When Listening enters the Learning state, it needs to wait a Forward Delay time (15s) for STP convergence. Learning to Forwarding also needs to wait. For a Forward Delay time, the MAC address table is perfected to prevent extensive flooding due to the empty MAC address table. No matter which state, as long as the port is disabled or the link fails, it will directly enter the Disabled state. The three states of Forwarding, Learning and Listening, as long as the port is no longer the designated port or root port, it will enter the Blocking state.

BPDU (Bridge Protocol Data Unit): Bridge Protocol Unit

1)配置BPDU(0x00):用来选举根交换机,以及确认每个交换机端口的角色和状态
2)TCNBPDU(拓扑变更BPDU:0x80):传递拓扑变更消息

Failure recovery

1.根桥故障:20+15*2=50
2.直连链路故障:15*2=30
3.非直连链路故障:20+15*2=50
4.拓扑变更导致MAC地址表错误:300

The process of topology change to shorten the MAC address table aging time:

1)SWC感知到网络拓扑发生变化后,会不间断地向SWB发生TCN BPDU报文
2)SWB收到SWC发来地TCN BPDU后,会把配置BPDU的Flag的TCA置1,发送给SWC,告知收到了TCN BPDU,停止发送TCN BPDU。
3)SWB向根桥转发TCN BPDU报文
4)SWA收到之后,会网络拓扑进行检查,确定之后,将配置BPDU的Flag的TC置1,发送给SWB,SWB收到之后,会将MAC地址表的老化时间修改为Forward Delay的时间
5)SWB转发TC置位的配置BPDU,SWC收到之后,会将MAC地址表的老化时间修改为Forward Delay的时间
6)最多等待15S,MAC地址表中的错误表项便会清除,重新开始MAC表项的学习及转发过程

Deficiency of STP

1、STP从初始状态→完全收敛至少30s(listening-learning-forwarding)
2、交换机有BP端口,若该交换机中的RP链路DOWN掉,BP端口切换成RP端口并进入转发状态至少需要50s
3、若该交换机没有BPd端口,则RP端口dowm,另一台交换机BP端口切换成DP并进入转发状态至少需要50s
4、交换机连接的终端链路进入转发需要30s
5、拓扑变更机制:
先由变更点朝根桥发送TCN消息,收到该消息的上游交换机会恢复TCA消息进行确认,最后TCN消息到达根桥后,再由根桥发送TC消息通知设备删除桥MAC地址表项。

RSTP

RSTP port role

Backup BP:指定端口的备份,提供另一条根桥到非根桥的被分别链路
Alternate AP:根端口的备份端口,指定桥到根桥的备份

RSTP port status

Discarding:不转发流量,不学习mac
Learning:不转发流量,学习mac
Forwarding:转发流量,学习mac

RSTP BPDU

Ver:2
BPDU TYPE:R/M STP(0x02)
BPDU flags:TCA TC
        Proposal:1为请求快速协商,运行P/A机制(P)
        Port role:2bit组成
                  00-未知端口
                  01-AP/BP
                  10-RP
                  11-DP
        Learning:1为learning
        Forwarding:1为转发状态
        若learning forwarding都为0,为discarding
        Agreement:1同意运行P/A机制(A)

RSTP fast convergence mechanism

P/A机制,使指定端口尽快进入转发状态
条件:点对点链路
基本原理:

RSTP optimization of topology changes

1.发生拓扑变化的交换机会发送TC置位的RSTP BPDU
2.其他交换机收到TC置位的RSTP BPDU会启动TC while Timer(2倍的Hello时间-4s),在时间内,会将除收到TC BPDU的接口和边缘端口之外的端口所学习的MAC地址进行清除,并且向其他非边缘端口发送TC BPDU,一旦TC While Timer超时,会停止发送TC BPDU。

protection mechanism

BPDU protection:
边缘端口配置,收到BPDU报文,会关闭接口,防止网络震荡
TC-BPDU flood protection:


Note: Failure of an edge port does not trigger TC-BPDU, but it will still accept TC-BPDU

Root protection:
收到更优BPDU,会discarding,不再转发报文,2*forwarding delay后不再接受到BPDU,恢复forwarding状态
Loop protection:
链路单向故障,根端口长时间收不到来自上游的BPDU,进入discarding状态

MSTP, multi-instance spanning tree

产生背景:单生成树不能实现负载分担,会产生次优路径

MST domain

启动MSTP
相同域名
相同的VLAN到生成树实例映射配置
相同的MSTP修订级别配置

The difference between the three

       标准      需要资源     收敛  
STP   802.1D     低          慢
RSTP  802.1W     中等        慢
MSTP  802.1S     中等或高     快

Guess you like

Origin www.cnblogs.com/afairyfairy/p/12679688.html