平台人生
作者平台人生·2016-11-29 14:39
软件开发工程师·平台人生

LACP链路聚合控制协议简介

字数 4186阅读 8835评论 0赞 0

作者:简志峰
文章来自微信公众号:平台人生

基于IEEE802.3ad标准的LACP (Link Aggregation Control Protocol,链路汇聚控制协议)是一种实现链路动态汇聚与解汇聚的协议,为交换数据的设备提供一种标准的协商方式。LACP根据设备端口的配置形成聚合链路并启动聚合链路收发数据。聚合链路形成后,LACP负责维护链路状态,在聚合条件发生变化时,自动调整或解散链路聚合,从而使两端设备对端口加入或退出某个动态汇聚组达成一致。

一、 IEEE802.3ad

IEEE 802.3ad 是执行链路聚合的标准方法。从概念上讲,将多个以太网适配器聚集到单独的虚拟适配器方面与“以太通道(EtherChannel)”功能相同,能提供更高的带宽防止发生故障。例如,ent0 和 ent1 可以聚集到称作 ent3 的 IEEE 802.3ad 链路聚合;然后用 IP 地址配置接口 en3。系统将这些聚集的适配器作为一个适配器来考虑。因此,可以像在任何以太网适配器上一样配置它们的 IP。
与“以太通道”一样,IEEE 802.3ad 也需要交换机的支持。然而不同的是,该交换机不需要手工配置来了解哪些端口属于同一个聚合。使用 IEEE 802.3ad链路聚合而不是“以太通道”的优势在于它在交换机中自动创建链路聚合,而且它允许使用支持 IEEE 802.3ad 标准但不支持“以太通道”的交换机。
在IEEE 802.3ad 中,链路聚合控制协议(LACP)自动通知交换机应该聚集哪些端口。IEEE 802.3ad 聚合配置之后,链路聚合控制协议数据单元就会在服务器和交换机之间进行交换。LACP会通知交换机在聚合中配置的适配器应作为交换机上的一个适配器来考虑,而不再有用户干涉。
要能够聚集适配器(也就是交换机将允许它们属于同一个聚合),它们的线路速度必须相同(例如,全都为 100 Mbps 或 1 Gbps),而且必须都是全双工的。如果试图将线路速度不同或不同全双工方式的适配器聚集在一起,在 AIX 上成功地创建聚合后,但是交换机可能不会将这些适配器聚集在一起。如果交换机不将适配器成功地聚集在一起,可能会发现网络性能有所下降。
根据 IEEE 802.3ad 的规范,前往相同 IP 地址的数据包都会通过相同的适配器进行发送。因此,当在 8023ad 方式下操作时,信息包会始终按照标准(Standard)的方式进行分发,而不会按照论询(Round-Robin)方式进行分发。

二、 LACP协议

LACPDU(LinkAggregation Control Protocol Data Unit,链路汇聚控制协议数据单元)

LACP 协议通过LACPDU与对端交互信息。使能某端口的 LACP 协议后,该端口将通过发送LACPDU 向对端通告自己的系统优先级、系统MAC、端口优先级、端口号和操作Key。对端接收到这些信息后,将这些信息与其它端口所保存的信息比较以选择能够汇聚的端口,从而双方可以对端口加入或退出某个动态汇聚组达成一致。

超时时间

LACP 超时时间是动态聚合组内的成员端口等待接收 LACPDU 的超时时间。LACP发送报文的频率可以配置为每隔1秒钟或者30秒钟发送一个LACP报文,这两种发送频率都是IEEE802.3ad标准所规定的。本端会将接收报文的超时时间通过LACP报文通知对端。
配置为short,对端发送LACP报文的周期为1秒;配置为long,对端发送LACP报文的周期为30秒。
LACP协议报文的超时时间为LACP报文发送周期的3倍,即:配置为short,接收LACP协议报文的超时时间为3秒。配置为long,接收LACP协议报文的超时时间为90秒。
两端配置的超时时间可以不一致。但为了便于维护,建议用户配置一致的LACP协议报文超时时间。

使用场合

1) 在带宽比较紧张的情况下,可以通过逻辑聚合可以扩展带宽到原链路的n倍
2) 在需要对链路进行动态备份的情况下,可以通过配置链路聚合实现同一聚合组各个成员端口之间彼此动态备份

三、EtherChannel中LACP相关配置

本文只针对AIX操作系统进行介绍EtherChannel中LACP的相关配置,其他操作系统类似。
在AIX操作系统中,通过smitetherchannel命令可以配置EtherChannel,配置过程中可以选择:

Mode(模式)

8023ad: 这种模式下会使用IEEE802.3ad 标准的LACP(Link Aggregation Control Protocol),可以自动实现链路聚合
Standard: 在这种模式下EtherChannel使用目标主机的IP地址来决定用哪一块网卡来发送数据。EtherChannel用目标IP的末字节除以成员网卡的个数的余数(模)来决定由哪一块网卡发送数据。比如目标IP是10.10.10.1, EtherChannel中有两块成员网卡, (1 % 2) = 1, 所以第二块网卡被用来发送数据 (网卡编号从0开始)。 网卡编号按照它们在smit界面中列出的顺序排列。对于非IP流量(如ARP), 目标MAC地址的末字节被用来进行计算。 这是默认的运行模式。
Round Robin: 在这种模式下各个成员网卡被轮流使用,每轮每个网卡发送一个数据包。

IEEE 802.3ad Interval

long: This is the default value of the interval. When selected, the EtherChannel will request LACP packets from its partner at longinterval value as specified by the protocol
short: When selected, the EtherChannel will request LACP packets from its partner at short interval value as specified by theprotocol。

Hash Mode

缺省模式下,数据包目的IP用于确定发送适配器。对于非IP数据包(如ARP),目的MAC地址的最后字节被用于确定发送适配器。

四、操作命令

在AIX操作系统中,可以使用命令 entstat来检查IEEE 802.3ad链路聚合相关问题。使用如下命令可以验证链路聚合的运行状态
entstat -d device
其中device为链路聚合设备
下述信息代表在每个聚合端口LACP的状态,在Actor端和Partner端都会显示:

System Priority: priority value for this system
System: value that uniquely identifies this system
Operational Key: value that denotes which ports may beaggregated together
Port Priority: priority value for this port
Port: unique value that identifies this port in the aggregation
State:

  • LACP activity: Active or Passive - whether to initiatesending LACPDUs always, or only in response toanother LACPDU: the IEEE 802.3ad Link Aggregationwill always operate in Active mode
  • LACP timeout: Long or Short - time to wait beforesending LACPDUs: the IEEE 802.3ad Link Aggregationwill always use the long timeout
  • Aggregation: Individual or Aggregatable - whether thisport can form an aggregation with other ports, orif it can only form an aggregation with itself:
    the port in a one-adapter IEEE 802.3ad Link Aggregationwill be marked as Individual, or Aggregatableif there are more than one ports
  • Synchronization: IN_SYNC or OUT_OF_SYNC - whether theaggregation has determined it has reachedsynchronization with the partner
  • Collecting: Enabled or Disabled - whether the IEEE 802.3adLink Aggregation is collecting (receiving) packets
  • Distributing: Enabled or Disabled - whether the IEEE 802.3adLink Aggregation is distributing (sending) packets
  • Defaulted: True or False - whether the IEEE 802.3adLink Aggregation is using default values forthe partner's information
  • Expired: True or False - whether the IEEE 802.3adLink Aggregation is operated in expired mode

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

0

添加新评论0 条评论

Ctrl+Enter 发表

本文隶属于专栏

作者其他文章

X社区推广