链路聚合介绍
链路聚合特性:
虚拟技术的一种,将多个以太网链路捆绑为一条逻辑的以太网链路;
所有链路的带宽都可以充分用来转发两台设备之间的流量;
三层链路连接两台设备,可以起到节省IP地址的作用。
二层环境中多条上行链路:
三层环境中部署有多条上行链路:
链路聚合的模式
手动模式:将多条连接同一台交换机的端口都添加到这个Eth-Trunk当中,然后再在对端交换机上执行对应的操作;
LACP模式:根据协商协议建立起来的Eth-Trunk
。
手动模式Eth-Trunk使用故障链路外的其他链路执行负载分担
缺点:手动模式Eth-Trunk可能因配置错误而无法正常通信
LACP模式的工作
选取主被动设备:双方交换机会使用系统优先级来判断谁充当两者中的LACP
主动端;如双方系统优先级相同,则MAC
地址较小的交换机会成为LACP
主动端;
选取主备用链路:主动端交换机根据自身端口优先级来决定,端口优先级的数值越低,代表优先级越高。
LACP模式Eth-Trunk的主用链路和备用链路
链路聚合的配置
网络拓扑示意图:
在SW1和SW2上实施手动配置的链路聚合功能
SW1:
<Huawei>system-view
[Huawei]sysname SW1
[SW1]interface Eth-Trunk 10
[SW1-Eth-Trunk10]trunkport Ethernet 0/0/1 to 0/0/3
[SW1-Eth-Trunk10]port trunk allow-pass vlan all
SW2:
<Huawei>system-view
[Huawei]sysname SWB
[SWB]interface Eth-Trunk 10
[SWB-Eth-Trunk10]trunkport Ethernet 0/0/1 to 0/0/3
[SWB-Eth-Trunk10]port link-type trunk
[SWB-Eth-Trunk10]port trunk allow-pass vlan all
在SW1上检查Eth-Trunk的配置和状态
[SW1]display eth-trunk 10
Eth-Trunk10's state information is:
WorkingMode: NORMAL Hash arithmetic: According to SIP-XOR-DIP
Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 3
--------------------------------------------------------------------------------
PortName Status Weight
Ethernet0/0/1 Up 1
Ethernet0/0/2 Up 1
Ethernet0/0/3 Up 1
在SW1和SW2上配置LACP
SW1:
[SW1]interface Eth-Trunk 20
[SW1-Eth-Trunk20]mode lacp-static
[SW1-Eth-Trunk10]trunkport Ethernet 0/0/1 to 0/0/3
SW2:
[SW2]interface Eth-Trunk 20
[SW2-Eth-Trunk20]mode lacp-static
[SW2-Eth-Trunk10]trunkport Ethernet 0/0/1 to 0/0/3
在SW1上检查Eth-Trunk的配置和状态
[SW1]display eth-trunk 20
Eth-Trunk20's state information is:
Local:
LAG ID: 20 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 32768 System ID: 4c1f-cc5e-760e
Least Active-linknumber: 1 Max Active-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 3
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/1 Selected 100M 32768 2 5153 10111100 1
Ethernet0/0/2 Selected 100M 32768 3 5153 10111100 1
Ethernet0/0/3 Selected 100M 32768 4 5153 10111100 1
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
Ethernet0/0/1 32768 4c1f-ccd8-5056 32768 2 5153 10111100
Ethernet0/0/2 32768 4c1f-ccd8-5056 32768 3 5153 10111100
Ethernet0/0/3 32768 4c1f-ccd8-5056 32768 4 5153 10111100
在SW1上设置LACP系统优先级并查看相关信息
[SW1]lacp priority 2000
[SW1]display eth-trunk 20
Apr 14 2020 09:11:04-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 7, the c
hange loop count is 0, and the maximum number of records is 4095.
[SW1]display eth-trunk 20
Eth-Trunk20's state information is:
Local:
LAG ID: 20 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 2000 System ID: 4c1f-cc5e-760e #这里优先级已经修改为2000
Least Active-linknumber: 1 Max Active-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 3
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/1 Selected 100M 32768 2 5153 10111100 1
Ethernet0/0/2 Selected 100M 32768 3 5153 10111100 1
Ethernet0/0/3 Selected 100M 32768 4 5153 10111100 1
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
Ethernet0/0/1 32768 4c1f-ccd8-5056 32768 2 5153 10111100
Ethernet0/0/2 32768 4c1f-ccd8-5056 32768 3 5153 10111100
Ethernet0/0/3 32768 4c1f-ccd8-5056 32768 4 5153 10111100
在SW1上设置LACP接口优先级并查看相关信息
[SW1]interface e0/0/1
[SW1-Ethernet0/0/1]lacp priority 1000
[SW1-Ethernet0/0/1]interface e0/0/2
[SW1-Ethernet0/0/2]lacp priority 2000
[SW1-Ethernet0/0/2]interface e0/0/3
[SW1-Ethernet0/0/3]lacp priority 3000
[SW1-Ethernet0/0/3]quit
[SW1]display eth-trunk 20
Eth-Trunk20's state information is:
Local:
LAG ID: 20 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 2000 System ID: 4c1f-cc5e-760e
Least Active-linknumber: 1 Max Active-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 3
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/1 Selected 100M 1000 2 5153 10111100 1 # e/0/1接口优先级修改为1000
Ethernet0/0/2 Selected 100M 2000 3 5153 10111100 1 # e/0/2接口优先级修改为2000
Ethernet0/0/3 Selected 100M 3000 4 5153 10111100 1 # e/0/3接口优先级修改为3000
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
Ethernet0/0/1 32768 4c1f-ccd8-5056 32768 2 5153 10111100
Ethernet0/0/2 32768 4c1f-ccd8-5056 32768 3 5153 10111100
Ethernet0/0/3 32768 4c1f-ccd8-5056 32768 4 5153 10111100
在SW1上设置Eth-Trunk 20中的活动接口数量并查看相关信息
[SW1]interface Eth-Trunk 20
[SW1-Eth-Trunk20]max active-linknumber 2
[SW1-Eth-Trunk20]quit
[SW1]display eth-trunk 20
Local:
LAG ID: 20 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 2000 System ID: 4c1f-cc5e-760e
Least Active-linknumber: 1 Max Active-linknumber: 2 # 活动接口的最大数量为2
Operate status: up Number Of Up Port In Trunk: 2
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/1 Selected 100M 1000 2 5153 10111100 1
Ethernet0/0/2 Selected 100M 2000 3 5153 10111100 1
Ethernet0/0/3 Unselect 100M 3000 4 5153 10100000 1 # 接口e0/0/3未被选中
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
Ethernet0/0/1 32768 4c1f-ccd8-5056 32768 2 5153 10111100
Ethernet0/0/2 32768 4c1f-ccd8-5056 32768 3 5153 10111100
Ethernet0/0/3 32768 4c1f-ccd8-5056 32768 4 5153 10110000
在SW1上禁用E0/0/1并查看Eth-Trunk状态
[SW1]display eth-trunk 20
Eth-Trunk20's state information is:
Local:
LAG ID: 20 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 2000 System ID: 4c1f-cc5e-760e
Least Active-linknumber: 1 Max Active-linknumber: 2
Operate status: up Number Of Up Port In Trunk: 2
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/1 Unselect 100M 1000 2 5153 10100010 1 # 接口e0/0/1未被选中其他两个接口已经被选中
Ethernet0/0/2 Selected 100M 2000 3 5153 10111100 1
Ethernet0/0/3 Selected 100M 3000 4 5153 10111100 1
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
Ethernet0/0/1 0 0000-0000-0000 0 0 0 10100011
Ethernet0/0/2 32768 4c1f-ccd8-5056 32768 3 5153 10111100
Ethernet0/0/3 32768 4c1f-ccd8-5056 32768 4 5153 10111100
在SW1上配置LACP抢占功能并查看相关信息
[SW1]interface Eth-Trunk 20
[SW1-Eth-Trunk20]lacp preempt enable
[SW1-Eth-Trunk20]lacp preempt delay
[SW1-Eth-Trunk20]quit
[SW1]interface e0/0/1
[SW1-Ethernet0/0/1]undo shutdown
[SW1-Ethernet0/0/1]quit
[SW1]display eth-trunk 20
Eth-Trunk20's state information is:
Local:
LAG ID: 20 WorkingMode: STATIC
Preempt Delay Time: 10 Hash arithmetic: According to SIP-XOR-DIP #preempt delay的时间为10
System Priority: 2000 System ID: 4c1f-cc5e-760e
Least Active-linknumber: 1 Max Active-linknumber: 2
Operate status: up Number Of Up Port In Trunk: 2
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/1 Selected 100M 1000 2 5153 10111100 1
Ethernet0/0/2 Selected 100M 2000 3 5153 10111100 1
Ethernet0/0/3 Unselect 100M 3000 4 5153 10100000 1
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
Ethernet0/0/1 32768 4c1f-ccd8-5056 32768 2 5153 10111100
Ethernet0/0/2 32768 4c1f-ccd8-5056 32768 3 5153 10111100
Ethernet0/0/3 32768 4c1f-ccd8-5056 32768 4 5153 10110000
在SW2上查看Eth-Trunk 20状态
[SW1]display eth-trunk 20
Eth-Trunk20's state information is:
Local:
LAG ID: 20 WorkingMode: STATIC
Preempt Delay Time: 10 Hash arithmetic: According to SIP-XOR-DIP
System Priority: 2000 System ID: 4c1f-cc5e-760e
Least Active-linknumber: 1 Max Active-linknumber: 2
Operate status: up Number Of Up Port In Trunk: 2
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/1 Selected 100M 1000 2 5153 10111100 1 #发现与SW1连接的e0/0/1又重新被选择
Ethernet0/0/2 Selected 100M 2000 3 5153 10111100 1
Ethernet0/0/3 Unselect 100M 3000 4 5153 10100000 1
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
Ethernet0/0/1 32768 4c1f-ccd8-5056 32768 2 5153 10111100
Ethernet0/0/2 32768 4c1f-ccd8-5056 32768 3 5153 10111100
Ethernet0/0/3 32768 4c1f-ccd8-5056 32768 4 5153 10110000