随着网络规模不断扩大,用户对骨干链路的带宽和可靠性提出了越来越高的要求。在传统技术中,常用更换高速率的接口板或更换支持高速率接口板的设备的方式来增加带宽,但这种方案需要付出高额的费用,而且不够灵活。
采用链路聚合技术可以在不进行硬件升级的条件下,通过将多个物理接口捆绑为一个逻辑接口,来达到增加链路带宽的目的。在实现增大带宽目的的同时,链路聚合采用备份链路的机制,可以有效的提高设备之间链路的可靠性。
链路聚合也称为链路绑定,称为:Link Aggregation、Link Trunking、Link Bonding 。针对的都是以太网链路
聚合组/聚合接口可以分为以下两种类型:
LACP协议
基于IEEE802.3ad标准的LACP Link Aggregation Control Protocol,链路聚合控制协议)协议是一种实现链路聚合的协议,运行该协议的设备之间通过互发LACPDU (Link Aggregation Control Protocol Data Unit,链路聚合控制协议数据单元)来交互链路聚合的相关信息
LACP协议功能的基本功能
利用LACPDU的基本字段可以实现LACP协议的基本功能,基本字段包含以下信息:系统LACP优先级、系统MAC地址、端口聚合优先级、端口编号和操作key.
动态聚合组内的成员端口会自动使能LACP协议,并通过发送LACPDU向对端通告本端的上述信息。当对端收到该LACPDU后,将其中的信息与本端其它成员端口收到的信息进行比较,以选择能够处于选中状态的成员端口,使双方可以对各自接口的选中/非选中状态达成一致,从而决定哪些链路可以加入聚合组以及某链路何时可以加入聚合组。可以理解为M: N架构, M即处于活动状态的链路, N即处于备份,暂时没有加入以太聚合的接口。
链路聚合能够提高链路带宽,增强网络可用性,支持负载分担(把数据放到不同的链路,聚合接口下,load-banlance ?)
手工负载分担模式下所有活动接口都参与数据的转发,分担负载流量
只有LACP模式支持链路备份,如果需建立链路备份,请使用LACP模式的链路聚合
以太聚合实施一般条件
如果是接入接口,需要接入相同的VLAN
[SW1]vlan batch 8 9 10 11 12 99
[SW1]interface GigabitEthernet 0/0/3
[SW1-GigabitEthernet0/0/3]port link-type trunk
[SW1-GigabitEthernet0/0/3]port trunk pvid vlan 99
[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/3]display this
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk pvid vlan 99
port trunk allow-pass vlan 2 to 4094
#
return
[SW1-GigabitEthernet0/0/3]in g0/0/5
[SW1-GigabitEthernet0/0/5] port link-type trunk
[SW1-GigabitEthernet0/0/5] port trunk pvid vlan 99
[SW1-GigabitEthernet0/0/5] port trunk allow-pass vlan 2 to 4094
#sw1的6口,sw2的1口5口6口,sw3的3口,1口同上实施,操作略
[SW1]display stp
-------[CIST Global Info][Mode MSTP]-------
CIST Bridge :32768.4c1f-ccb7-3b11
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :32768.4c1f-cca0-1ef8 / 20000
CIST RegRoot/IRPC :32768.4c1f-ccb7-3b11 / 0
CIST RootPortId :128.5
BPDU-Protection :Disabled
TC or TCN received :19
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:25m:36s
Number of TC :9
Last TC occurred :GigabitEthernet0/0/5
---- More ----
[SW1]stp mod
[SW1]stp mode ?
mstp Multiple Spanning Tree Protocol (MSTP) mode
rstp Rapid Spanning Tree Protocol (RSTP) mode
stp Spanning Tree Protocol (STP) mode
[SW1]stp mode stp
#sw2,sw3都更改为stp模式,操作略。现网一般使用MSTP
[SW1]interface eth-trunk 12 #创建以太聚合接口(逻辑接口)
[SW1-Eth-Trunk12]trunkport GigabitEthernet 0/0/5 to 0/0/6 #将物理接口g0/0/5,g0/0/6加入聚合接口eth-trunk 12
Info: This operation may take a few seconds. Please wait for a moment...
Error: The port has other configurations. Please clear them first. #请先清空接口的配置,系统视图clear configuration int g0/0/5 clear configuration int g0/0/6
[SW2]clear configuration int g0/0/5
[SW2]clear configuration int g0/0/6
[SW2-Eth-Trunk12]trunkport GigabitEthernet 0/0/5 to 0/0/6
[SW2-Eth-Trunk12] port link-type trunk #聚合接口下实施端口类型,会自动下发到物理成员端口
[SW2-Eth-Trunk12] port trunk pvid vlan 99
[SW2-Eth-Trunk12] port trunk allow-pass vlan 2 to 4094
[SW2]dis eth-trunk 12
Eth-Trunk12's state information is:
WorkingMode: NORMAL Hash arithmetic: According to SIP-XOR-DIP
Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 2
--------------------------------------------------------------------------------
PortName Status Weight
GigabitEthernet0/0/5 Up 1 #如果物理接口处于down,需要进入此接口视图shutdown,undo shutdown
GigabitEthernet0/0/6 Up 1
dis interface Eth-Trunk 12
Eth-Trunk12 current state : UP
Line protocol current state : UP
Description:
Switch Port, PVID : 99, Hash arithmetic : According to SIP-XOR-DIP,Maximal BW: 2G, Current BW: 2G, The Maximum Frame Length is 9216
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cca0-1ef8
Current system time: 2020-01-06 19:37:08-08:00
Input bandwidth utilization : 0%
Output bandwidth utilization : 0%
-----------------------------------------------------
PortName Status Weight
-----------------------------------------------------
GigabitEthernet0/0/5 UP 1
GigabitEthernet0/0/6 UP 1
-----------------------------------------------------
The Number of Ports in Trunk : 2
Port Cost(Dot1T ) :Config=auto / Active=10000 #g0/0/5和6口开销变小为10000
#SW3同上
链路聚合后 查看lsw2的stp,[lsw2]display stp bri 此时端口Eth-Trunk12 的角色为ROOT
[SW2]display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/1 DESI LEARNING NONE
0 GigabitEthernet0/0/2 DESI LEARNING NONE
0 Eth-Trunk12 ROOT FORWARDING NONE
[RTA]interface eth-trunk 1
[RTA-Eth-Trunk1]undo portswitch #默认二层,开启支持三层接口,部分交换机型号支持
[RTA-Eth-Trunk1]ip address 100.1.1.1 24 #三层网络层可以配置ip
[RTA-Eth-Trunk1]quit [RTA]interface GigabitEthernet 0/0/1
[RTA-GigabitEthernet0/0/1]eth-trunk 1
[RTA-GigabitEthernet0/0/1]quit
[RTA]interface GigabitEthernet0/0/2
[RTA-GigabitEthernet0/0/2]eth-trunk 1
[RTA-GigabitEthernet0/0/2]quit
参考:HCNA网络技术学习指南-第10章链路技术,HCIA-Routing & Switching ,红宝书案例15华为网络的以太链路聚合