本文最后更新于 131 天前,其中的信息可能已经有所发展或是发生改变。
- 示例界面,实际以自己实际情况调整
华为交换机配置链路聚合
(Eth-Trunk),是将多个物理接口捆绑为一个逻辑接口,实现增加链路带宽、提高可靠性、提供负载分担的目的。
链路聚合两种模式:手工负载分担模式(默认模式,默认负载均衡方式src-dst-ip 适用于:交换机与服务器之间), LACP模式(适用于:网络设备之间 推荐 )。
交换机 手工模式下
SW1
[SW1]interface Eth-Trunk 1
[SW1-Eth-Trunk1]mode manual load-balance //选择为手动负载分担,缺省即为手工模式,可不配置
[SW1-Eth-Trunk1]load-balance ? //查看可配置的模式,缺省为src-dst-ip,
dst-ip According to destination IP hash arithmetic
dst-mac According to destination MAC hash arithmetic
src-dst-ip According to source/destination IP hash arithmetic //缺省的配置
src-dst-mac According to source/destination MAC hash arithmetic
src-ip According to source IP hash arithmetic
src-mac According to source MAC hash arithmetic
[SW1-Eth-Trunk1]load-balance src-dst-ip //此处使用src-dst-ip
[SW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 to 0/0/2 //把GE0/0/1到GE0/0/2加入
配置Eth-Trunk 1为trunk模式,并放通vlan 10 和20
[SW1]interface Eth-Trunk 1
[SW1-Eth-Trunk1]port link-type trunk
[SW1-Eth-Trunk1]port trunk allow-pass vlan 10 20
SW2
SW2
[SW2]interface Eth-Trunk 1
[SW2-Eth-Trunk1]mode manual load-balance
[SW2-Eth-Trunk1]load-balance src-dst-ip
[SW2-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 to 0/0/2
配置Eth-Trunk 1为trunk并放通vlan10和20
[SW2]interface Eth-Trunk 1
[SW2-Eth-Trunk1]port link-type trunk
[SW2-Eth-Trunk1]port trunk allow-pass vlan 10 20
交换机 LACP模式
当需要在两个直连设备间提供一个较大的链路带宽并且设备都支持LACP协议时,建议使用LACP模式。 LACP模式不仅可以实现增加带宽、提高可靠性、负载分担的目的,而且可以提高Eth-Trunk的容错性、提供备份功能。 在LACP模式下,部分链路是活动链路,所有活动链路均参与数据转发。如果某条活动链路故障,链路聚合组自动在非活动链路中选择一条链路作为活动链路,来参与数据转发。
如下图SW1和SW2各自的GE0/0/1、GE0/0/2、GE0/0/3加入链路聚合中,GE0/0/3作为备份链路。
SW1
[SW1]interface Eth-Trunk 2 //创建eth-trunk 2聚合口
[SW1-Eth-Trunk2]mode lacp-static //配置模式为lacp静态模式
[SW1-Eth-Trunk2]trunkport GigabitEthernet 0/0/1 to 0/0/3 //把GE0/0/1 到GE0/0/3加入到聚合组
在SW1上配置系统优先级为100,使其成为LACP主动端
[SW1]lacp priority 100
在SW1上配置活动接口上限阈值为2
[SW1]interface Eth-Trunk 2
[SW1-Eth-Trunk2]max active-linknumber 2
在SW1进入物理接口配置接口优先级,确定活动链路,此处只配置GE1和GE2口,GE3口保持默认值32768。
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]lacp priority 100
[SW1]interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2]lacp priority 100
配置Eth-Trunk2接口为trunk,并允许VLAN10和VLAN20通过(vlan配置过程省略)
[SW1]interface Eth-Trunk 2
[SW1-Eth-Trunk2]port link-type trunk
[SW1-Eth-Trunk2]port trunk allow-pass vlan 10 20
SW2
[SW2]interface Eth-Trunk 2
[SW2-Eth-Trunk2]mode lacp
分别把GE0/0/1、GE0/0/2、GE0/0/3加入到聚合口(此处采用的另一种方法,不是批量加入了)
[SW2]interface GigabitEthernet 0/0/1
[SW2-GigabitEthernet0/0/1]eth-trunk 2
[SW2]interface GigabitEthernet 0/0/2
[SW2-GigabitEthernet0/0/2]eth-trunk 2
[SW2]interface GigabitEthernet 0/0/3
[SW2-GigabitEthernet0/0/3]eth-trunk 2
SW2上优先级保持默认,在SW2上配置活动接口上限阈值为2
[SW2]interface Eth-Trunk 2
[SW2-Eth-Trunk2]max active-linknumber 2
配置Eth-Trunk2接口为trunk,并允许VLAN10和VLAN20通过(vlan配置过程省略)
[SW2]interface Eth-Trunk 2
[SW2-Eth-Trunk2]port link-type trunk
[SW2-Eth-Trunk2]port trunk allow-pass vlan 10 20
查看Eth-Trunk
<S6720-SW01>dis Eth-Trunk 1
Eth-Trunk1's state information is:
Local:
LAG ID: 1 WorkingMode: LACP
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 32768 System ID: 8446-fea3-2ae0
Least Active-linknumber: 1 Max Active-linknumber: 32
Operate status: up Number Of Up Port In Trunk: 2
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
XGigabitEthernet0/0/1 Selected 10GE 100 1 321 10111100 1
XGigabitEthernet0/0/2 Selected 10GE 32768 2 321 10111100 1
Partner:
--------------------------------------------------------------------------------
ActorPortName SysPri SystemID PortPri PortNo PortKey PortState
XGigabitEthernet0/0/1 65535 b405-5d44-9988 255 1 15 10111100
XGigabitEthernet0/0/2 65535 b405-5d44-9988 255 2 15 10111100
<S6720-SW01>dis interface Eth-Trunk 1
Eth-Trunk1 current state : UP
Line protocol current state : UP
Description:NFS01
Switch Port, Link-type : access(configured),
PVID : 20, Hash arithmetic : According to SIP-XOR-DIP,Maximal BW: 20G, Current BW: 20G, The Maximum Frame Length is 9216
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 8446-fea3-2ae0
Current system time: 2023-08-11 16:41:43+08:00
Last 300 seconds input rate 1112403736 bits/sec, 131297 packets/sec
Last 300 seconds output rate 1934492976 bits/sec, 181835 packets/sec
Input: 11153716925 packets, 11592415256803 bytes
Unicast: 11153711357, Multicast: 5426
Broadcast: 28, Jumbo: 0
Discard: 0, Pause: 0
Frames: 0
Total Error: 0
CRC: 0, Giants: 0
Jabbers: 0, Fragments: 0
Runts: 0, DropEvents: 0
Alignments: 0, Symbols: 0
Ignoreds: 0
Output: 15265239086 packets, 20127954788330 bytes
Unicast: 15265179046, Multicast: 54620
Broadcast: 5404, Jumbo: 0
Discard: 479, Pause: 0
Total Error: 0
Collisions: 0, ExcessiveCollisions: 0
Late Collisions: 0, Deferreds: 0
Buffers Purged: 0
Input bandwidth utilization : 5.56%
Output bandwidth utilization : 9.67%
-----------------------------------------------------
PortName Status Weight
-----------------------------------------------------
XGigabitEthernet0/0/1 UP 1
XGigabitEthernet0/0/2 UP 1
-----------------------------------------------------
The Number of Ports in Trunk : 2
The Number of UP Ports in Trunk : 2