链路聚合

概念原理

链路聚合是把两台设备之间的多条物理链路聚合在一起,当做一条逻辑链路来使用。

链路聚合能够提高链路带宽,能够提供高可靠性。

链路聚合可以在一个聚合口上实现负载均衡,将流量均匀分布在聚合链路的所有物理接口上。

链路聚合包含两种模式:手动负载分担和LACP模式。

  手动负载分担:聚合组的建立、成员口的加入都由手工配置,没有链路聚合控制协议参与。

  LACP模式:链路两端设备相互发送LACP报文,协商聚合参数。

两种模式的区别:在LACP中,一些链路充当备份链路,在手动模式中,所有的成员都处于转发状态。

在一个聚合链路中,所有成员端口的参数必须保持一致,包括物理接口数量、传输速率、双工模式、流量控制模式。

聚合链路的成员口可以是二层接口也可以是三层接口。

数据流控制:

数据流在聚合链路上传输,数据的顺序必须保持不变,一个数据流可以看做是一组MAC和IP地址相同的帧。

当设备两端只有一条物理链路时,那么数据流是总能按照正确的顺序到达目的地,当配置了链路聚合后,多条物理链路被绑定为一条逻辑链路,一个数据流中的帧通过不同的物理链路发送,可能会造成后面的数据帧先到的情况,为了避免这种情况发生,链路聚合采用了逐流负载分担的方式,这种方式把数据流中的地址通过HASH算法生成HASH-KEY值,然后根据HASH-KEY值选择不同的出接口,这样就保证了同一个数据流在同一条物理链路上传输。

逐流负载分担能保证包的顺序但不能保证带宽利用率。

链路聚合配置:

1、         二层链路聚合

 

手动负载分担方式:

[RTA]interface Eth-Trunk 1  //创建聚合口

[RTA-Eth-Trunk1]port link-type trunk  //指定聚合口为Trunk口

[RTA-Eth-Trunk1]port trunk allow-pass vlan 10 20 30  //允许通过的VLAN

[RTA]interface GigabitEthernet 0/0/1

[RTA-GigabitEthernet0/0/1]eth-trunk 1  //将接口加入聚合口

[RTA]interface g0/0/2

[RTA-GigabitEthernet0/0/2]eth-trunk 1  //将接口加入聚合口

[RTB]interface Eth-Trunk 1

[RTB-Eth-Trunk1]port link-type trunk

[RTB-Eth-Trunk1]port trunk allow-pass vlan 10 20 30

[RTB]interface GigabitEthernet 0/0/1

[RTB-GigabitEthernet0/0/1]eth-trunk 1

[RTB]interface g0/0/2

[RTB-GigabitEthernet0/0/2]eth-trunk 1

//如果一个对端接口直接和本端聚合链路中的一个成员口相连,该对端接口也必须加入一个聚合链路,否则两端无法通信。

静态LACP模式:

[RTA]interface Eth-Trunk 1

[RTA-Eth-Trunk1]mode lacp-static //静态LACP模式

[RTA-Eth-Trunk1]port link-type trunk

[RTA-Eth-Trunk1]port trunk allow-pass vlan 10 20 30

[RTA]interface GigabitEthernet 0/0/1

[RTA-GigabitEthernet0/0/1]eth-trunk 1

[RTA]interface g0/0/2

[RTA-GigabitEthernet0/0/2]eth-trunk 1

[RTB]interface Eth-Trunk 1

[RTB-Eth-Trunk1]mode lacp-static

[RTB-Eth-Trunk1]port link-type trunk

[RTB-Eth-Trunk1]port trunk allow-pass vlan 10 20 30

[RTB]interface GigabitEthernet 0/0/1

[RTB-GigabitEthernet0/0/1]eth-trunk 1

[RTB]interface g0/0/2

[RTB-GigabitEthernet0/0/2]eth-trunk 1

[RTA]lacp priority 100  //配置RTA设备LACP系统优先级为100

[RTA]interface GigabitEthernet 0/0/1  

[RTA-GigabitEthernet0/0/1]lacp priority 100  //设置端口的LACP优先级为100

[RTA]interface GigabitEthernet 0/0/2  

[RTA-GigabitEthernet0/0/2]lacp priority 100  //设置端口的LACP优先级为100

//LACP系统和接口的LACP优先级默认为32768,当修改为小于32768时将成为LACP主动端。

2、         三层链路聚合

以太口:

[RTA]interface Eth-Trunk 1

[RTA-Eth-Trunk1]undo portswitch   //将聚合口转为三层接口

[RTA-Eth-Trunk1]ip address 10.1.1.1 24  //为聚合口添加地址

[RTA]interface g0/0/1

[RTA-GigabitEthernet0/0/1]eth-trunk 1

[RTA]interface g0/0/2

[RTA-GigabitEthernet0/0/2]eth-trunk 1

[RTB]interface Eth-Trunk 1

[RTB-Eth-Trunk1]undo portswitch   //将聚合口转为三层接口

[RTB-Eth-Trunk1]ip address 10.1.1.1 24  //为聚合口添加地址

[RTB]interface g0/0/1

[RTB-GigabitEthernet0/0/1]eth-trunk 1

[RTB]interface g0/0/2

[RTB-GigabitEthernet0/0/2]eth-trunk 1

串口:

[AR3]interface Mp-group 0/0/1  //创建聚合端口1

[AR3-Mp-group0/0/1]ip address 10.1.1.1 24   //为聚合口添加IP

[AR3]interface Serial 1/0/0

[AR3-Serial1/0/0]ppp mp Mp-group 0/0/1  //加入聚合端口组1

[AR3-Serial1/0/0]link-protocol ppp  //指定端口封装协议

[AR3-Serial1/0/0]ppp authentication-mode pap  //指定接口二层认证模式

[AR3-Serial1/0/0]ppp pap local-user test1 password simple 123456  //指定pap认证用户名和密码

[AR3]interface Serial 1/0/1

[AR3-Serial1/0/1]ppp mp Mp-group 0/0/1

[AR3-Serial1/0/1]link-protocol ppp

[AR3-Serial1/0/1]ppp authentication-mode pap

[AR3-Serial1/0/1]ppp pap local-user test1 password simple 123456

[AR4]interface Mp-group 0/0/1  //创建聚合端口1

[AR4-Mp-group0/0/1]ip address 10.1.1.1 24   //为聚合口添加IP

[AR4]interface Serial 1/0/0

[AR4-Serial1/0/0]ppp mp Mp-group 0/0/1  //加入聚合端口组1

[AR4-Serial1/0/0]link-protocol ppp  //指定端口封装协议

[AR4-Serial1/0/0]ppp authentication-mode pap  //指定接口二层认证模式

[AR4-Serial1/0/0]ppp pap local-user test1 password simple 123456  //指定pap认证用户名和密码

[AR4]interface Serial 1/0/1

[AR4-Serial1/0/1]ppp mp Mp-group 0/0/1

[AR4-Serial1/0/1]link-protocol ppp

[AR4-Serial1/0/1]ppp authentication-mode pap

[AR4-Serial1/0/1]ppp pap local-user test1 password simple 123456

原文地址:https://www.cnblogs.com/wushuai2018/p/14100832.html