链路聚合原理
逻辑链路的带宽增加了大约(n-1)倍,这里,n为聚合的路数。另外,聚合后,可靠性大大提高,因为,n条链路中只要有一条可以正常工作,则这个链路就可以工作。除此之外,链路聚合可以实现负载均衡。因为,通过链路聚合连接在一起的两个(或多个)交换机(或其他网络设备),通过内部控制,也可以合理地将数据分配在被聚合连接的设备上,实现负载分担。链路聚合又可以分为手工模式和LACP模式 ,LACP模式需要有链路集合控制协议LACP的参与。LACP模式的优点有:
1.增加带宽:链路聚合可以将多个链路捆绑成为一个逻辑链路,捆绑后的链路带宽是每个独立链路的带宽总和。
2.提高可靠性: 链路聚合中的多个链路互为备份,当有一条链路断开,流量会自动在剩下链路间重新分配。
3. 提供备份功能
创建拓扑图
1.配置链路聚合手动模式
SW1
<Huawei>system-view
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname SW1
配置SW1的链路聚合组
[SW1]int Eth-Trunk 10 //创建聚合组序号为10
[SW1-Eth-Trunk10]trunkport GigabitEthernet 0/0/1 to 0/0/3 //把g0/0/1到0/0/3添加到组
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1-Eth-Trunk10]port link-type trunk //把三个端口设置为Trunk口
[SW1-Eth-Trunk10]port trunk allow-pass vlan all //允许所有的VLAN通过
SW2
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW2
Info: Information center is disabled.
配置SW2的链路聚合组
[SW2]int Eth-Trunk 10
[SW2-Eth-Trunk10]trunkport GigabitEthernet 0/0/1 to 0/0/3
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2-Eth-Trunk10]port link-type trunk
[SW2-Eth-Trunk10]port trunk allow-pass vlan all
分别在2个交换机上查看Eth-trunk配置情况和状态
2.配置链路聚合LACP模式
SW1
[SW1]int Eth-Trunk 10 //创建链路聚合组10
[SW1-Eth-Trunk10]mode lacp-static //配置链路聚合模式LACP
[SW1-Eth-Trunk10]trunkport GigabitEthernet 0/0/1 to 0/0/3 //把g0/0/1-0/0/3添加到组
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1-Eth-Trunk10]quit
SW2
[SW2]int Eth-Trunk 10
[SW2-Eth-Trunk10]mode lacp-static
[SW2-Eth-Trunk10]trunkport GigabitEthernet 0/0/1 to 0/0/3
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2-Eth-Trunk10]quit
查看交换机SW1链路聚合组的配置情况和状态
在SW1上设置LACP系统优先级并查看相关信息
在SW1上修改最大活动接口
[SW1-Eth-Trunk10]max active-linknumber 5 //设置最大活动端口数为5
在SW1上修改LACP抢占功能并且查看信息
[SW1]int Eth-Trunk 10
[SW1-Eth-Trunk10]lacp preempt enable//启用LACP抢占功能
[SW1-Eth-Trunk10]lacp preempt delay 10//抢占延迟为10
[SW1-Eth-Trunk10]quit
观察SW1的链路聚合状态
观察SW2的链路聚合状态
总结:
维度 | 手工模式 | LACP模式 |
---|---|---|
Eth-Trunk的建立方式 | Eth-Trunk的建立、成员接口的加入由手工配置,没有链路聚合控制协议的参与。 | Eth-Trunk的建立是基于LACP协议的,LACP为交换数据的设备提供一种标准的协商方式,以供系统根据自身配置自动形成聚合链路并启动聚合链路收发数据。聚合链路形成以后,负责维护链路状态。在聚合条件发生变化时,自动调整或解散链路聚合。 |
设备是否需要支持LACP协议 | 不需要 | 需要 |
数据转发 | 正常情况下,所有链路都是活动链路。所有活动链路均参与数据转发。如果某条活动链路故障,链路聚合组自动在剩余的活动链路中分担流量。 | 正常情况下,部分链路是活动链路。所有活动链路均参与数据转发。如果某条活动链路故障,链路聚合组自动在非活动链路中选择一条链路作为活动链路,参与数据转发的链路数目不变。 |
是否支持跨设备的链路聚合 | 不支持 | 支持 |
检测故障 | 只能检测到同一聚合组内的成员链路有断路等有限故障,但是无法检测到链路断连、错连等故障。 | 不仅能够检测到同一聚合组内的成员链路有断路等有限故障,还可以检测到链路故障、链路错连等故障。 |