链路聚合
链路聚合是将多个物理链路捆绑成一个逻辑链路,以增加链路带宽、提高可靠性和实现负载均衡的技术。
原理
将多个物理链路的带宽进行合并,形成一个更高带宽的逻辑链路。同时,通过一定的算法,将数据流量均匀地分配到各个物理链路上,实现负载均衡。当其中某个物理链路出现故障时,流量会自动切换到其他正常的物理链路上,从而提高了网络的可靠性。
优点
增加带宽:多个物理链路的带宽相加,能为网络提供更高的数据传输速率,满足大量数据传输的需求。
提高可靠性:当一条物理链路出现故障时,数据可以通过其他正常链路传输,不会导致网络中断,增强了网络的容错能力。
负载均衡:数据流量能够均匀地分布在各个链路上,避免了单个链路负载过高,而其他链路闲置的情况,充分利用了网络资源。
应用场景
数据中心:服务器之间需要大量的数据传输,链路聚合可以提供高带宽和高可靠性,确保数据中心内部网络的稳定运行。
园区网核心层和汇聚层:用于连接核心交换机和汇聚交换机,承载大量的用户数据流量,通过链路聚合可以提高网络的传输能力和可靠性。
广域网连接:在连接不同地区的网络时,链路聚合可以将多个低速链路合并成一个高速链路,提高广域网的连接质量和稳定性。
实验拓扑
实验需求
- 按照图示配置PC3和PC4的IP地址
- 在SW1和SW3的三条直连链路上配置链路聚合,实现链路冗余,并可以增加传输带宽
- SW1和SW2之间的直连链路要配置为Trunk类型,允许所有VLAN通过
- 中断SW1和SW2之间的一条直连链路,测试PC3和PC4是否仍然能够继续访问
实验步骤
-
按照拓扑图示配置IP地址
-
在SW1和SW2的直连链路上配置链路聚合,实现链路冗余,并可以增加传输带宽
<H3C>sys System View: return to User View with Ctrl+Z. [H3C]sysname SW1 [SW1]interface Bridge-Aggregation 1 [SW1-Bridge-Aggregation1]quit [SW1]interface GigabitEthernet 1/0/1 [SW1-GigabitEthernet1/0/1]port link-aggregation group 1 [SW1-GigabitEthernet1/0/1]int g1/0/2 [SW1-GigabitEthernet1/0/2]port link-aggregation group 1 [SW1-GigabitEthernet1/0/2]int g1/0/3 [SW1-GigabitEthernet1/0/3]port link-aggregation group 1 [SW1-GigabitEthernet1/0/3]quit [SW1]
<H3C>sys System View: return to User View with Ctrl+Z. [H3C]sysname SW2 [SW2]interface Bridge-Aggregation 1 [SW2-Bridge-Aggregation1]quit [SW2]interface GigabitEthernet 1/0/1 [SW2-GigabitEthernet1/0/1]port link-aggregation group 1 [SW2-GigabitEthernet1/0/1]int g1/0/2 [SW2-GigabitEthernet1/0/2]port link-aggregation group 1 [SW2-GigabitEthernet1/0/2]int g1/0/3 [SW2-GigabitEthernet1/0/3]port link-aggregation group 1 [SW2-GigabitEthernet1/0/3]quit [SW2]
//查看链路聚合状态,发现已经成功运行 [SW1]display link-aggregation verbose Loadsharing Type: Shar -- Loadsharing, NonS -- Non-Loadsharing Port: A -- Auto Port Status: S -- Selected, U -- Unselected, I -- Individual Flags: A -- LACP_Activity, B -- LACP_Timeout, C -- Aggregation, D -- Synchronization, E -- Collecting, F -- Distributing, G -- Defaulted, H -- Expired Aggregate Interface: Bridge-Aggregation1 Aggregation Mode: Static Loadsharing Type: Shar Port Status Priority Oper-Key -------------------------------------------------------------------------------- GE1/0/1 S 32768 1 GE1/0/2 S 32768 1 GE1/0/3 S 32768 1 [SW1]
-
SW1和SW2之间的直连链路要配置为Trunk类型,允许所有VLAN通过
[SW1]interface Bridge-Aggregation 1 [SW1-Bridge-Aggregation1]port link-type trunk Configuring GigabitEthernet1/0/1 done. Configuring GigabitEthernet1/0/2 done. Configuring GigabitEthernet1/0/3 done. [SW1-Bridge-Aggregation1]port trunk permit vlan all Configuring GigabitEthernet1/0/1 done. Configuring GigabitEthernet1/0/2 done. Configuring GigabitEthernet1/0/3 done. [SW1-Bridge-Aggregation1]quit [SW1]
[SW2]interface Bridge-Aggregation 1 [SW2-Bridge-Aggregation1]port link-type trunk Configuring GigabitEthernet1/0/1 done. Configuring GigabitEthernet1/0/2 done. Configuring GigabitEthernet1/0/3 done. [SW2-Bridge-Aggregation1]port trunk permit vlan all Configuring GigabitEthernet1/0/1 done. Configuring GigabitEthernet1/0/2 done. Configuring GigabitEthernet1/0/3 done. [SW2-Bridge-Aggregation1]quit [SW2]
//测试能够ping通
-
中断SW1和SW2之间的一条直连链路,测试PC3和PC4是否仍然能够继续访问
[SW1]interface GigabitEthernet 1/0/1 [SW1-GigabitEthernet1/0/1]shutdown %Mar 12 10:32:42:447 2025 SW1 LAGG/6/LAGG_INACTIVE_PHYSTATE: Member port GE1/0/1 of aggregation group BAGG1 changed to the inactive state, because the physical state of the port is down. %Mar 12 10:32:42:447 2025 SW1 IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet1/0/1 changed to down. %Mar 12 10:32:42:447 2025 SW1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet1/0/1 changed to down.
//查看接口状态
[SW1-GigabitEthernet1/0/1]display this # interface GigabitEthernet1/0/1 port link-mode bridge port link-type trunk port trunk permit vlan all combo enable fiber shutdown port link-aggregation group 1 # return [SW1-GigabitEthernet1/0/1]display ip interface brief *down: administratively down (s): spoofing (l): loopback Interface Physical Protocol IP Address Description MGE0/0/0 down down -- -- [SW1-GigabitEthernet1/0/1]quit [SW1]display this # sysname SW1 # irf mac-address persistent timer irf auto-update enable undo irf link-delay irf member 1 priority 1 # lldp global enable # system-working-mode standard xbar load-single password-recovery enable lpu-type f-series # stp global enable # scheduler logfile size 16 # domain default enable system # return [SW1]display ip interface brief *down: administratively down (s): spoofing (l): loopback Interface Physical Protocol IP Address Description MGE0/0/0 down down -- -- [SW1]display link-aggregation verbose Loadsharing Type: Shar -- Loadsharing, NonS -- Non-Loadsharing Port: A -- Auto Port Status: S -- Selected, U -- Unselected, I -- Individual Flags: A -- LACP_Activity, B -- LACP_Timeout, C -- Aggregation, D -- Synchronization, E -- Collecting, F -- Distributing, G -- Defaulted, H -- Expired Aggregate Interface: Bridge-Aggregation1 Aggregation Mode: Static Loadsharing Type: Shar Port Status Priority Oper-Key -------------------------------------------------------------------------------- GE1/0/1 U 32768 1 GE1/0/2 S 32768 1 GE1/0/3 S 32768 1 [SW1]display link-aggregation summary Aggregation Interface Type: BAGG -- Bridge-Aggregation, BLAGG -- Blade-Aggregation, RAGG -- Route-Aggregation, SCH-B -- Schannel-Bundle Aggregation Mode: S -- Static, D -- Dynamic Loadsharing Type: Shar -- Loadsharing, NonS -- Non-Loadsharing Actor System ID: 0x8000, 44d0-468a-0100 AGG AGG Partner ID Selected Unselected Individual Share Interface Mode Ports Ports Ports Type -------------------------------------------------------------------------------- BAGG1 S None 2 1 0 Shar [SW1]
//测试结果