RSTP

来源:互联网 发布:js onclick 传递参数 编辑:程序博客网 时间:2024/06/08 14:41

 

RSTP(Rapid Spanning Tree Protocol)协议在bridged LAN网络中产生一个full、simple、symmetric的active topology,阻塞某些端口,避免环路。full是指连接所有的end station,simple是指active topology是一颗生成树,数据只能沿着树传输,symmetric是指任意两个end station之间的双向流量走的路径是一样的。RSTP协议也保证网络拓扑变化时不会产生临时环路(temporary loop)。但是不能阻止由于非bridge的网络设备形成的环路(如repeater)。RSTP用来取代STP协议,可以与运行STP协议的bridge在网络中混合使用,但是这种情况下,就失去了RSTP的rapid特性。rapid特性会增加报文重复和乱序的概率,对乱序敏感的业务需要去掉rapid特性,增加端口状态切换的时间间隔。

1 协议设计要求

      1)RSTP协议配置bridge端口状态,forwarding状态的端口允许收发数据,discarding状态端口丢弃数据报文

      2)支持故障容忍(fault tolerance),网络设备出现故障,或新增网络设备或端口,协议会自动重新生成active topology

      3)网络状态变化时,重新达到网络稳定状态的中间时间(bouned interval)时间很短,使对任意end station之间的通信阻断影响时间很短

      4)active topology可以预知和可重现,利于性能管理

      5)rstp对end station是透明的,end station之间的通信不需要感知bridge的存在

      6)运行rstp需要的带宽很小,而且rstp的带宽跟网络的规模无关

      7)运行rstp所需的存储资源与网络中bridge和lan的个数无关

      8)bridge加入网络中不需要进行特殊的额外配置

2 实现协议的要求

      1)唯一的group mac address,用来识别rstp entity

      2)每一个bridge有一个的标识符,在整个bridged LAN中是唯一的

      3)每一个端口有一个标识符,在整个bridge中是唯一的

      4)每一个bridge有一个在bridged LAN中的相对优先级(relative priority)

      5)每一个端口有一个在bridge中的相对优先级(relative priority)

      6)每一个端口有一个port path cost 值

 

3 RSTP概述

  RSTP网络有一个bridge叫root bridge,是生成树的树根。每一个bridge有一个端口叫做root port,这个端口是这个bridge所有端口中到root bridge的path cost最小的端口。每一个LAN相连的所有端口中到root bridge的path cost最小的端口叫designated port。而alternate port 和backup port则是当设备出现故障时会作为通信端口的端口。

每一个bridge会发送配置消息(configuration message),消息里会携带生成树优先级向量,如哪个bridge是root bridge,本bridge各个端口到root bridge的path cost是多少等。其他的bridge根据接收的配置消息内容运行rstp协议,计算自己所有端口的状态。

如果bridge的一个端口没有连接任何其他bridge,可能通过管理面会配置成edge port或自动发现是edge port,edge port会直接变为forwarding状态

3.1 拓扑的计算

    bridge identifier最好的bridge被选为root bridge。bridge的地位数字就是bridge的相对优先级。

    每一个bridge有一个root path cost,root path cost是指bridge端口到root的最小path cost。

    bridge的root path cost最小的端口是root port,如果多个port的root path cost相同,则port identifier优先级(优先级由port identifier的地位数字表示)最好的port为root port

   LAN相连的bridge中到root的path cost最小的bridge叫做designated bridge。designated bridge与lan相连的端口为designated port。如果designated bridge有多个端口与这个LAN相连,则port identifier最好的为designated port,其他的端口为backup port。而这个LAN相连的其他bridge的端口叫做alternate port。

   每个LAN只有一个designated bridge。

3.2 举例说明

   图例说明

 

网络物理拓扑图


RSTP计算出来的active topology


bridge的端口角色和状态


4 优先级向量和port role

   configuration message优先级向量的内容如下:

   a) Root Bridge Identifier, the Bridge Identifier of the Bridge believed to be the Root by the transmitter
   b) Root Path Cost, to that Root Bridge from the transmitting Bridge
   c) Bridge Identifier, of the transmitting Bridge
  d) Port Identifier, of the Port through which the message was transmitted
 e) Port Identifier, of the Port through which the message was received (where relevant),不在configuration message中传递

 port role:

 disabled port(mac_operational为false或Administrative Bridge Port state为disabled或(802.1X)端口为网络接入端口,且AuthControlledPortStatus为Unauthorized)

 root port,designated port,alternate port,backup port

5 生成树信息

  BPDU传递两种信息:configuration message和TCN(topology change notification)message。configuration message可以在configuration PDU或RST PDU中传递。TCN message可以在TCN PDU或RST PDU中传递。

  configuration message会在designated port周期性的发送,这样可以检测网络中是否有设备出现故障

6 port 状态

   root port,designated port的port状态为forwarding

  alternate port,backup port的port状态为discarding

   port状态变为discarding时会立即转换成discarding,转换为forwarding时需要确定其他bridge已经准备好


状态对BPDU的处理对数据报文的处理disabled不接收、不发送不接收、不发送、不学习discarding接收、不发送不接收、不发送、不学习learning接收、发送不接收、不发送、学习forwarding接收、发送接收、发送、学习