链路聚合(Link Aggregation),也称为端口捆绑,端口聚集或链路聚集。链路聚合是将多个端口聚合在一起形成一个汇聚组,以实现出/入负荷在和成员端口中的分担。从外面看起来,一个汇聚组好像就是一个端口。
使用链路汇聚服务的上层实体把同一聚合组内多条物理链路视为一条逻辑链路
链路聚合在数据链路层上实现
1)流量负载分担:出/入流量可以在多个成员接口之间分担。
2)增加带宽:链路捆绑接口的带宽是各可用成员接口带宽的总和。
3)提高连接可靠性:当某个成员接口出现故障时,流量会自动切换到其他可用的成员接口上,从而提高整个捆绑 链路的连接可靠性。
聚合链路两端的物理参数必须保持一致
1.进行聚合的链路的数目要保持一致
2.进行聚合的链路的速率要保持一致
3.进行聚合的链路为全双工方式 要保持一致
聚合链路两端的逻辑参数必须要保持一致
同一个汇聚组中端口的基本配置必须保持一致
基本配置主要包括STP,QoS,VLAN,端口等相关配置
BPDU是网桥协议数据单元(Bridge Protocol Data Unit)是一种生成树协议问候数据包
它以可配置的间隔发出,用来在网络的网桥间进行信息交换
二层链路捆绑
交换机与交换机之间的
二三层链路捆绑
交换机与路由器之间的
三层链路捆绑
路由器与路由器之间的
配置链路捆绑是会用到LACP,所以我们必须了解LACP
以太网链路聚合是指将多条以太网物理链路捆绑在一起成为一条逻辑链路,从而实现增加链路带宽的目的。链路聚合分为手工模式和LACP模式
LACP模式需要有链路聚合控制协议LACP的参与,当需要在两个直连设备间提供一个较大的链路带宽而设备支持LACP协议时,建议使用LACP模式。LACP模式不仅可以实现增加带宽,提高可靠性,负载分担的目的,而且可以提高Eth-Trunk的容错性,提供备份功能。
LACP模式下,部分链路是活动链路,所有活动链路均参与数据转发。如果某条活动链路故障,链路聚合组自动在非活动链路中选择一条链路作为活动链路,参与数据转发的链路数据不变。
在华为模拟器ensp上设置两个普通路由器,两个交换机,两台PC
先打开ensp ,新建2个路由器和2个pc用户,分别用网线连接,如下图
[Huawei]sySname SW1
[SW1]lacp priority 1000
[SW1]int Eth-Trunk 1
[SW1-Eth-Trunk1]bpdu enable
[SW1-Eth-Trunk1]mode lacp-static
[SW1-Eth-Trunk1]int e0/0/10
[SW1-Ethernet0/0/10]eth-trunk 1
[SW1-Ethernet0/0/10]int e0/0/11
[SW1-Ethernet0/0/11]eth-trunk 1
[SW1-Ethernet0/0/12]int e0/0/12
[SW1-Ethernet0/0/12]eth-trunk 1
[SW1]dis eth-trunk 1
LAG ID: 1 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 1000 System ID: 4c1f-cc57-3c56
Least Active-linknumber: 1 Max Active-linknumber: 8
Operate status: down Number Of Up Port In Trunk: 0
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/10 Unselect 100M 32768 11 289 10100010 1
Ethernet0/0/11 Unselect 100M 32768 12 289 10100010 1
Ethernet0/0/12 Unselect 100M 32768 13 289 10100010 1
配置最大跑的链接数
[SW1]int Eth-Trunk 1
[SW1-Eth-Trunk1]max active-linknumber 2
[SW1-Eth-Trunk1]dis eth-trunk 1
Eth-Trunk1's state information is:
Local:
LAG ID: 1 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 1000 System ID: 4c1f-cc57-3c56
Least Active-linknumber: 1 Max Active-linknumber: 2
Operate status: down Number Of Up Port In Trunk: 0
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/10 Unselect 100M 32768 11 289 10100010 1
Ethernet0/0/11 Unselect 100M 32768 12 289 10100010 1
Ethernet0/0/12 Unselect 100M 32768 13 289 10100010 1
[Huawei]sysname SW2
[SW2]int Eth-Trunk 1
[SW2-Eth-Trunk1]bpdu enable
[SW2-Eth-Trunk1]mode lacp-static
[SW2-Eth-Trunk1]q
[SW2]int e0/0/10
[SW2-Ethernet0/0/10]eth-trunk 1
[SW2]int e0/0/11
[SW2-Ethernet0/0/11]eth-trunk 1
[SW2-Ethernet0/0/11]q
[SW2]int e0/0/12
[SW2-Ethernet0/0/12]eth-trunk 1
[SW2-Ethernet0/0/12]q
[SW2]dis eth-trunk 1
Local:
LAG ID: 1 WorkingMode: STATIC
Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP
System Priority: 32768 System ID: 4c1f-cc66-7854
Least Active-linknumber: 1 Max Active-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 2
--------------------------------------------------------------------------------
ActorPortName Status PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/10 Selected 100M 32768 11 289 10111100 1
Ethernet0/0/11 Selected 100M 32768 12 289 10111100 1
Ethernet0/0/12 Unselect 100M 32768 13 289 10110000 1
配置SW2
[SW2]int vlanif 1
[SW2-Vlanif1]ip add 192.168.10.3 24
[SW2-Vlanif1]dis ip int brief
Interface IP Address/Mask Physical Protocol
MEth0/0/1 unassigned down down
NULL0 unassigned up up(s)
Vlanif1 192.168.10.3/24 up up
配置SW1
[SW1]int vlanif 1
[SW1-Vlanif1]ip add 192.168.10.2 24
[SW1-Vlanif1]dis ip int brief
Interface IP Address/Mask Physical Protocol
MEth0/0/1 unassigned down down
NULL0 unassigned up up(s)
Vlanif1 192.168.10.2/24 up up
[SW1]int Eth-Trunk 2
[SW1-Eth-Trunk2]trunkport GigabitEthernet 0/0/1 to 0/0/2
[SW1-Eth-Trunk2]dis eth-trunk 2
PortName Status Weight
GigabitEthernet0/0/1 Up 1
GigabitEthernet0/0/2 Up 1
[Huawei]sysname R1
[R1]int Eth-Trunk 2
[R1-Eth-Trunk2]trunkport GigabitEthernet 0/0/0 to 0/0/1
[R1-Eth-Trunk2]ip add 192.168.10.1 24
[R1-Eth-Trunk2]display ip int brief
Interface IP Address/Mask Physical Protocol
Eth-Trunk2 192.168.10.1/24 up up
[R1-Eth-Trunk2]int Eth-Trunk 1
[R1-Eth-Trunk1]trunkport GigabitEthernet 0/0/2 to 0/0/3
[R1-Eth-Trunk1]ip add 12.0.0.1 30
[R1-Eth-Trunk1]display ip int brief
Interface IP Address/Mask Physical Protocol
Eth-Trunk1 12.0.0.1/30 up up
Eth-Trunk2 192.168.10.1/24 up up
[R2]interface Eth-Trunk 5
[R2-Eth-Trunk5]trunkport g 0/0/2 to 0/0/3
[R2-Eth-Trunk5]ip add 12.0.0.2 30
[R2-Eth-Trunk5]dis ip int brief
Interface IP Address/Mask Physical Protocol
Eth-Trunk5 12.0.0.2/30 up up
R2需要配置静态路由
[R2]ip route-static 192.168.10.0 24 12.0.0.1
[R2]display ip routing-table
Destination/Mask Proto Pre Cost Flags NextHop Interface
12.0.0.0/30 Direct 0 0 D 12.0.0.2 Eth-Trunk5
12.0.0.2/32 Direct 0 0 D 127.0.0.1 Eth-Trunk5
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.10.0/24 Static 60 0 RD 12.0.0.1 Eth-Trunk5