GARP Overview

来源:互联网 发布:电视盒子 直播软件 编辑:程序博客网 时间:2024/06/04 20:13

 

GARP

1. Overview

通用属性注册协议(GARP)提供了一种通用机制供桥接局域网设备相互之间(如终端站和交换机等)注册或注销属性值,如 VLAN 标识符。这样,属性信息在整个桥接局域网设备中传播开来,并且这些设备形成活动拓朴结构的一个子集 -“可达性”树。GARP 定义了结构、操作规则、状态机制以及变量来声明注册或注销属性值。

交换机或终端站中的 GARP 参与者主要由连接端口或交换机的 GARP 应用程序和 GARP 信息声明 (GID)两部分构成。具有相同网桥应用程序的 GARP 参与者之间的信息传播是由 GARP 信息传播部分 (GIP)完成的。参与者之间通过 LLC 服务类型 1 实现协议交换过程,其中采用的是 MAC 地址组和 GARP 应用程序定义的 PDU 格式。

GARP 是针对 IEEE 802.1D (生成数协议)规范的 IEEE 802.1P 扩展的一部分。GARP 协议主要包括:

  • GARP 信息声明 (GID):GARP 生成数据部分。
  • GARP 信息传播 (GIP):GARP 数据分配部分 。
  • GARP 组播注册协议(GMRP):为参与者动态注册和注销连接相同局域网的 MAC 桥信息。

这三部分的结构如图1所示。
GARP Architecture

图1 GARP Architecture

GARP PDU

协议ID - 识别 GARP 协议。

标识符 - 十进制值,帮助匹配请求和答复。

属性类型 - 定义属性,值可能是:1组属性;2服务要求属性。

属性长度 - 指属性具有的长度。

属性事件 - 属性事件值可能为:

  • 0 Leave_all
  • 1 Join_Empty operator
  • 2 Join_In operator
  • 3 Leave_Empty operator
  • 4 Leave_In operator
  • 5 Empty operator

属性值 - 根据属性类型规范进行编码。

结束符 - 编码为0。

个人感觉上图对于GARP PDU的描述不够清楚,下面内容来自802.1D,清楚准确的描述了这部分内容:

GARP PDU ::= Protocol ID, Message {, Message}, End Mark

Protocol ID SHORT ::= 1

Message ::= Attribute Type, Attribute List

Attribute Type BYTE ::= Defined by the specific GARP Application

Attribute List ::= Attribute {,Attribute}, End Mark

Attribute ::= Ordinary Attribute | LeaveAll Attribute

Ordinary Attribute ::= Attribute Length, Attribute Event, Attribute Value

LeaveAll Attribute ::= Attribute Length, LeaveAll Event

Attribute Length BYTE ::= 2-255

Attribute Event BYTE ::= JoinEmpty | JoinIn | LeaveEmpty | LeaveIn | Empty

LeaveAll Event BYTE ::= LeaveAll

Attribute Value ::= Defined by the specific GARP Application

End Mark ::= 0x00 | End of PDU

LeaveAll ::= 0

JoinEmpty ::= 1

JoinIn ::= 2

LeaveEmpty ::= 3

LeaveIn ::= 4

Empty ::= 5

2. Protocol Operation

本节主要介绍GARP运作的方式。以及该协议的设计理念。须知每个GARP参与者维护了一个全局的LeaveAll组件(就是下面的LeaveAll状态机)。同时为每个属性维护了一个注册者(Applicant)和一个申请者(Registrar).

2.1 Registrar

注册者的用途是记录LAN上的其他参与者声明的属性值。其不需要发送任何协议消息。注册者维护了一个定时器(Leave Time),拥有以下三个状态:

  • a) IN—I have registered the fact that this Attribute value has been declared on this LAN.
  • b) MT—(Empty) All declarations for this Attribute value on this LAN have been withdrawn.
  • c) LV—I had registered this Attribute value, but am now timing out the registration (using the leave timer). If I do not see a declaration for this Attribute before leave timer expires, I will become MT.

注册者接收到消息的动作如下:

  • d) A Join message, either JoinIn or JoinEmpty, causes the Registrar to become IN (I have registered the Attribute).
  • e) If the Registrar was IN, then a Leave or LeaveAll causes it to become LV (I am timing out the registration) and starts the leave timer. Otherwise (LV or MT) there is no effect.
  • f) An Empty message (someone else has no registration for this Attribute) has no effect.

具体内容参见3节中的Registrar State Machine。虽然注册者不发送消息,但是其影响注册者发送的消息类型。如果注册者处于IN状态,那么申请者发送的消息类型为JoinIn,其他时候发送的是JoinEmpty。

2.2 Applicant

申请者的作用有两点:

  • a) 确保参与者的声明能够被其他参与者注册。
  • b) 确保其他希望保持该属性注册的参与者在有人离开的情况下(send leave message),能够重新声明。

注意:条目a)用在所有三种状态机下。条目b)仅仅用于Full GARP State Machine。关于状态机的类型可以参阅3节。

3. State Machine

GARP中每个应用的每个属性都具有一个状态机。这个状态机存在于参与者内部。状态机的种类从不同角度讲可以有很多分类,我是这样分类的,将其分为三类:

Full GARP State Machine

Applicant-Only Participants State Machine

Simple-Applicant Participants State Machine

上面三个State Machine的复杂程度由深到浅。每个都是上一个的简化版本。应用于不同场合。下面让我们看下状态机使用到的术语缩写:

3.1 事件缩写

事件属于

3.2 状态缩写

状态术语

下面是状态机的具体内容:

3.3 Full State Machine

Full GARP State Machine

GARP LeaveAll State Machine

GARP LeaveAll State Machine,这个状态机仅仅出现在Full State Machine中。在下面两个状态机中这个机制被去除了。

3.4 Applicant-Only Participants State Machine

GARP Applicant-Only Participants State Machine

3.5 Simple-Applicant Participants State Machine

GARP Simple-Applicant Participants State Machine

4.Interoperability considerations

本节记录了GARP协议实现时需要满足的一些重要的规则。GARP协议的正确性依赖于相互交互的一组参与者能够保持顺序性。例如参与者A无法在接收到C PDU之前收到B PDU(B PDU是参与者B接收到C PDU之后产生的)。这就是所谓的顺序性。对于参与者全部处于相同的LAN时,这种顺序性是必然的。如果参与者需要通过干预桥(intervening Bridge)连接,就造成了一些不确定性。所谓干预桥就是没有实现某个GARP应用,或者根本没有实现GARP的交换机。如果要在桥接的情况下保持顺序性,如下规则是必须被遵守的:

  • 如果端口X接收到GARP A PDU,并且打算向端口Y和Z转发。首先向端口Y转发,此时端口Y接收到了GARP B PDU,这个PDU需要向端口Y转发,那么A一定要在B之前在端口Y上转发。

如果这个规则没有被满足,会造成注册丢失的可能性增大。本协议不建议在没有遵守上面规则的交换机上运行。

Reference

IEEE802.1D

GARP网络资料

Attachments

 

原创粉丝点击