LACP是什么?
基于IEEE802.3ad标准的LACP,英文全称 Link Aggregation Control Protocol, 翻译成中文叫做链路汇聚控制协议,用于实现链路动态汇聚与解汇聚。
LACP通过LACPDU与对端交互信息。DU指Data Unit,数据单元。可以向对端通告MAC地址,优先级,端口号,Key等。对端接收到信息后,通过与其保存的信息进行比较和计算,确定加入或退出某个汇聚组。
主要用来干啥呢?对,汇聚嘛,当然是用来做端口汇聚。还可以做负载分担,链路备份(自动倒换)。
注意,手工配置的负载分担,配置基本的Eth-Trunk接口模式,不需配置LACP,成员接口(selected)都参与数据转发。
配置LACP的话,可以配置成静态或动态。区别在于,静态模式下,成员接口都是手工配置加入,但那些接口是selected,那些是standby的则由LACP协议决定。动态模式下,包括成员接口的加入,活动接口的选择,都是由LACP协议决定,即使说,启动动态LACP的设备不需创建Eth-Trunk接口,也不需要指定接口。
使用LACP协议的时候,Selected和Standby端口都能收发LACPDU, 但standby接口不转发用户报文。
另外,在使用LACP的情况下,无论是静态汇聚还是动态汇聚,看到的standby端口状态是down的。
下面看一下实际案例,
Huawei NE05E G0/2/4及G0/2/5 两个10G口做Trunk与OLT(MA5800X7)组网双上行(0/8/0 1, 0/9/0 1)配置如下:
#NE05E:
#
interface Eth-Trunk15
portswitch
port trunk allow-pass vlan 1 to 100
mode lacp-static
load-balance l4
#
interface GigabitEthernet0/2/4
undo shutdown
eth-trunk 15
dcn
#
interface GigabitEthernet0/2/5
undo shutdown
eth-trunk 15
dcn
#
#MA5800X7:
[lacp-config]
<lacp-config>
link-aggregation lacp-key 0/8/0 1
link-aggregation add-member 0/8/0 0/9 0
link-aggregation add-member 0/8/0 0/9 1
link-aggregation add-member 0/8/0 0/9 2
link-aggregation add-member 0/8/0 0/9 3
#
在MA5800的配置里,实际上display current的时候看不到类似“ link-aggregation add-member 0/8/0 0/9 0” 这些语句,但是可以通过不同命令来查看。 下面“display lacp link-aggregation summary” 可以看到selected端口有2个,standby的有6个,分别对应0/8/0 和0/9/0 和其余6个未selected的端口(其实这些端口都没有物理连接,主要是两个10G口上行就足够了,光模块省点用)
(config)#display lacp link-aggregation summary
{ <cr>||<K> }:
Command:
display lacp link-aggregation summary
Actor
Priority : 32768 MAC Address: 7858-6000-e7ab
Short Period : 1 s Long Period: 30 s
Priority Preemption: Disable Timeout : Fast
----------------------------------------------------------------------------
Agg Partner Partner Select Standby Load Backup Master Admin
ID Pri MAC Ports Ports Sharing Protect Port Key
----------------------------------------------------------------------------
1 32768 80b5-75c2-27e5 2 6 YES NO 0 /8 /0 1
----------------------------------------------------------------------------
(config)#display lacp link-aggregation verbose 1
{ <cr>||<K> }:
Command:
display lacp link-aggregation verbose 1
System Priority : 32768
MAC Address : 7858-6000-e7ab
Protect Mode : Non-BackupProtect
Admin Key : 1
Preempt Delay(s): 0
Master Port: 0/8/0
Actor Port Priority : 16384 Oper-key : 1
Port Role : SELECTED Port Status: C&D
Partner System Priority: 32768 MAC Address: 80b5-75c2-27e5
Port Priority : 32768 Oper-key : 3905
Sub Port: 0/9/0
Actor Port Priority : 16384 Oper-key : 1
Port Role : SELECTED Port Status: C&D
Partner System Priority: 32768 MAC Address: 80b5-75c2-27e5
Port Priority : 32768 Oper-key : 3905
Sub Port: 0/8/1
Actor Port Priority : 16384 Oper-key : 0
Port Role : STANDBY Port Status: Non-C&D
Sub Port: 0/8/2
Actor Port Priority : 16384 Oper-key : 0
Port Role : STANDBY Port Status: Non-C&D
Sub Port: 0/8/3
Actor Port Priority : 16384 Oper-key : 0
Port Role : STANDBY Port Status: Non-C&D
Sub Port: 0/9/1
Actor Port Priority : 16384 Oper-key : 0
Port Role : STANDBY Port Status: Non-C&D
Sub Port: 0/9/2
Actor Port Priority : 16384 Oper-key : 0
Port Role : STANDBY Port Status: Non-C&D
Sub Port: 0/9/3
Actor Port Priority : 16384 Oper-key : 0
Port Role : STANDBY Port Status: Non-C&D
看一下路由器上的统计:
[~NE05E_01]disp lacp brief
System Priority: 32768
System ID : 80b5-75c2-27e5
[~NE05E_01]disp lacp statistics eth-trunk 15
Eth-Trunk15's PDU statistic is:
-------------------------------------------------------------------------------
Port LacpRevPdu LacpSentPdu MarkerRevPdu MarkerSentPdu
GigabitEthernet0/2/4 764414 23278073 0 0
GigabitEthernet0/2/5 764422 23278081 0 0
[~NE05E_01]disp int Eth-Trunk 15
Eth-Trunk15 current state : UP (ifindex: 38)
Line protocol current state : UP
Link quality grade : GOOD
Description:
Switch Port, TPID : 8100(Hex), Hash arithmetic : According to flow,Maximal BW: 20Gbps, Current BW: 20Gbps, The Maximum Transmit Unit(L3) is 1500 bytes
Internet protocol processing : disabled
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 80b5-75c2-27e5
Current system time: 2019-05-17 23:11:49
Physical is ETH_TRUNK
Last 300 seconds input rate 817341 bits/sec, 914 packets/sec
Last 300 seconds output rate 23899360 bits/sec, 2080 packets/sec
Input: 2349976240 packets,344045983992 bytes
2308742671 unicast,39406270 broadcast,1827299 multicast
0 errors,0 drops
Output:5942717725 packets,8154570342640 bytes
5814368771 unicast,77054633 broadcast,51294321 multicast
0 errors,0 drops
Last 300 seconds input utility rate: 0.01%
Last 300 seconds output utility rate: 0.11%
----------------------------------------------------------
PortName Status Weight
----------------------------------------------------------
GigabitEthernet0/2/4 UP 1
GigabitEthernet0/2/5 UP 1
----------------------------------------------------------
The Number of Ports in Trunk : 2
The Number of UP Ports in Trunk : 2
[~NE05E_01]disp eth-trunk 15
Eth-Trunk15's state information is:
Local:
LAG ID: 15 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to flow
System Priority: 32768 System ID: 80b5-75c2-27e5
Least Active-linknumber: 1 Max Active-linknumber: 8
Operate status: up Number Of Up Ports In Trunk: 2
Timeout Period: Slow
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/2/4 Selected 10GE 32768 1 3905 10111100 1
GigabitEthernet0/2/5 Selected 10GE 32768 2 3905 10111100 1
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
GigabitEthernet0/2/4 32768 7858-6000-e7ab 16384 1 1 11111100
GigabitEthernet0/2/5 32768 7858-6000-e7ab 16384 5 1 11111100
我做了链路测试一切正常,细节不说了。
顺便说一下,我这还有一些Adtran OLT TA5000系列,双主控板上行链路汇聚叫做Cross-slot LAG, 配置如下(配置lag的时候要看当前主用板是那块,1/A就用下面模板,1/B的话相应修改):
interface ten-gigabit-ethernet 1/A/1
lacp mode active
no shutdown
exit
interface ten-gigabit-ethernet 1/B/1
lacp mode active
no shutdown
exit
lacp response-mode 1/A interactive
interface lag-group 1/A/1
cross-slot
alias "LAG1"
link ten-gigabit-ethernet 1/A/1
link ten-gigabit-ethernet 1/B/1
active-links-minimum 1
no shutdown
exit
no ethernet default interface
ethernet default interface lag-group LAG1
查看状态:
OL02-EAS-LON#sh int lag
lag-group 1/B/1 is IS And up
Alias : LAG1
Cross-Slot : enabled
Minimum Active Links : 1
Active Links : 2
Link : ten-gig-eth 1/B/1 (UP)
Link : ten-gig-eth 1/A/1 (UP)