华为交换机配置链路聚合

链路聚合(Eth-Trunk),是将多个物理接口捆绑为一个逻辑接口,实现增加链路带宽、提高可靠性、提供负载分担的目的。

链路聚合两种模式:手工负载分担模式(默认模式,默认负载均衡方式src-dst-ip),LACP模式(推荐)。

一,手工模式下,Eth-Trunk的建立、成员接口的加入由手工配置,没有LACP的参与。手工模式下所有活动链路都参与数据的转发,平均分担流量。如果某条活动链路发生故障,链路聚合组会自动在剩余的活动链路中平均分担流量。

当需要在两个直连设备之间提供一个较大的链路带宽,而其中一端或两端设备都不支持LACP协议时,可以配置手工模式链路聚合。

bgp自动聚合与手工聚合 手工聚合和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 20SW2
 [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

使用命令display eth-trunk 1查看

bgp自动聚合与手工聚合 手工聚合和lacp聚合_华为_02

**===============================================================**

二,LACP模式
当需要在两个直连设备间提供一个较大的链路带宽并且设备都支持LACP协议时,建议使用LACP模式。
LACP模式不仅可以实现增加带宽、提高可靠性、负载分担的目的,而且可以提高Eth-Trunk的容错性、提供备份功能。
在LACP模式下,部分链路是活动链路,所有活动链路均参与数据转发。如果某条活动链路故障,链路聚合组自动在非活动链路中选择一条链路作为活动链路,来参与数据转发。

如下图SW1和SW2各自的GE0/0/1、GE0/0/2、GE0/0/3加入链路聚合中,GE0/0/3作为备份链路。

bgp自动聚合与手工聚合 手工聚合和lacp聚合_Ethernet_03

配置过程

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-static //配置模式为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

使用命令display eth-trunk 2分别在SW1和SW2上查看接口情况

SW1上查看

bgp自动聚合与手工聚合 手工聚合和lacp聚合_链路_04

SW2

bgp自动聚合与手工聚合 手工聚合和lacp聚合_网络_05


把SW1的GE0/0/1口shutdown,

[SW1]interface GigabitEthernet 0/0/1
 [SW1-GigabitEthernet0/0/1]shutdown

再次查看聚合口情况,GE0/0/3已切换为选中状态了。

bgp自动聚合与手工聚合 手工聚合和lacp聚合_华为_06

三,交换机和其它设备常用的链路聚合采用的模式
1,和服务器互联时,
服务器和接入设备的链路聚合模式要匹配。当服务器选择静态链接聚合方式,对应接入设备应该选择手工模式;当服务器选择IEEE 802.3ad动态链接聚合方式,对应接入设备应该选择LACP模式。
2,和堆叠设备互联时,
交换机与堆叠系统通过链路聚合互联,同时使能Eth-Trunk接口流量本地优先转发功能,在保证数据流量可靠传输的同时可以减小堆叠设备之间的带宽承载压力,提高了流量转发效率。