链路聚合实验

实验拓扑图

image

实验需求

1.按照图示配置PC3和PC4的IP地址
2.在SW1和SW2的两条直连链路上配置链路聚合,实现链路冗余,并可以增加传输带宽
3.SW1和SW2之间的直连链路要配置为Trunk类型,允许所有vlan通过
4.中断SW1和SW2之间的一条直连链路,测试PC3和PC4是否仍然能够继续访问

实现

1.PC配置IP地址部分

image

2.在SW1和SW2的直连链路上配置链路聚合

  分析:SW1和SW2之间通过g1/0/1和g1/0/2接口直连,需要在两台交换机上分别创建聚合接口,并把g1/0/1和g1/0/2接口加入到聚合接口,形成链路聚合。被聚合的物理接口的vlan配置和接口类型要保持一致,所以在配置链路聚合前,物理端口不要做任何其他配置,保持默认状态即可

步骤1:在SW1上创建Bridge-Aggregation 1号聚合接口
[SW1]interface Bridge-Aggregation 1
步骤2:进入g1/0/1和g1/0/2接口的接口视图,分别把两个接口加入到聚合接口

点击查看代码
[SW1]interface g1/0/1
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1
%Aug 28 16:58:20:200 2026 SW1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet1/0/1 changed to down.
%Aug 28 16:58:20:218 2026 SW1 IFNET/3/IF_WARN: The jumboframe of the aggregate interface Bridge-Aggregation1 is not supported on the member port GigabitEthernet1/0/1
[SW1-GigabitEthernet1/0/1]%Aug 28 16:58:20:238 2026 SW1 LAGG/6/LAGG_ACTIVE: Member port GE1/0/1 of aggregation group BAGG1 changed to the active state.
%Aug 28 16:58:20:260 2026 SW1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet1/0/1 changed to up.
%Aug 28 16:58:20:261 2026 SW1 IFNET/3/PHY_UPDOWN: Physical state on the interface Bridge-Aggregation1 changed to up.
%Aug 28 16:58:20:263 2026 SW1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface Bridge-Aggregation1 changed to up.
%Aug 28 16:58:22:811 2026 SW1 STP/6/STP_NOTIFIED_TC: Instance 0's port GigabitEthernet1/0/2 was notified a topology change.
%Aug 28 16:58:22:816 2026 SW1 STP/6/STP_DETECTED_TC: Instance 0's port Bridge-Aggregation1 detected a topology change.


[SW1-GigabitEthernet1/0/1]interface g1/0/2
[SW1-GigabitEthernet1/0/2]port link-aggregation group 1
[SW1-GigabitEthernet1/0/2]%Aug 28 16:58:32:675 2026 SW1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet1/0/2 changed to down.
%Aug 28 16:58:32:679 2026 SW1 IFNET/3/IF_WARN: The jumboframe of the aggregate interface Bridge-Aggregation1 is not supported on the member port GigabitEthernet1/0/2
%Aug 28 16:58:32:688 2026 SW1 LAGG/6/LAGG_ACTIVE: Member port GE1/0/2 of aggregation group BAGG1 changed to the active state.
%Aug 28 16:58:32:705 2026 SW1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet1/0/2 changed to up.
%Aug 28 16:58:33:808 2026 SW1 STP/6/STP_NOTIFIED_TC: Instance 0's port Bridge-Aggregation1 was notified a topology change.
%Aug 28 16:58:36:560 2026 SW1 STP/6/STP_NOTIFIED_TC: Instance 0's port Bridge-Aggregation1 was notified a topology change.


步骤3:查看链路聚合状态,发现已经成功运行
点击查看代码
[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
[SW1]%Aug 28 16:58:50:573 2026 SW1 STP/6/STP_NOTIFIED_TC: Instance 0's port Bridge-Aggregation1 was notified a topology change.

步骤4:SW2上命令与SW1上完全一致,这里省略

image

3.SW1和SW2之间的直连链路要配置为Trunk类型,允许所有vlan通过

分析:物理接口加入到聚合接口后,会自动继承聚合接口的vlan相关配置,所以不需要在物理接口上分别配置Trunk,只需要在聚合接口下配置Trunk即可

步骤1:在SW1的Bridge-Aggregation 1接口的接口视图下,把该聚合接口配置为Trunk,并允许所有vlan通过。命令执行完毕后,会显示配置已经在g1/0/1和g1/0/2接口上自动完成

点击查看代码
[SW1]interface Bridge-Aggregation 1
[SW1-Bridge-Aggregation1]port link-type trunk
Configuring GigabitEthernet1/0/1 done.
Configuring GigabitEthernet1/0/2 done.
[SW1-Bridge-Aggregation1]port trunk permit vlan all
Configuring GigabitEthernet1/0/1 done.
Configuring GigabitEthernet1/0/2 done.
[SW1-Bridge-Aggregation1]

步骤2:SW2上命令与SW1上完全一致,这里省略

image

4.中断SW1和SW2之间的一条直连链路,测试PC3和PC4是否仍然能够继续访问

  分析:链路聚合会自动把SW1和SW2之间的流量进行负载均衡,某一条链路中断连接后,也仍然还有另外一条链路可以继续通讯,所以PC3和PC4可以继续访问

步骤1:进入SW1的g1/0/1接口的接口视图,使用shutdown命令关闭接口

点击查看代码

[SW1]interface g1/0/1
[SW1-GigabitEthernet1/0/1]shutdown
[SW1-GigabitEthernet1/0/1]%Aug 28 17:06:53:742 2026 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.
%Aug 28 17:06:53:749 2026 SW1 IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet1/0/1 changed to down.
%Aug 28 17:06:53:753 2026 SW1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet1/0/1 changed to down.


步骤2:测试结果,PC3仍然可以Ping通PC4

image

备注

两台交换机 SW1、SW2,两根网线 GE1/0/1、GE1/0/2 互连。
把 2 个物理端口捆绑成 1 个逻辑接口 Bridge‑Aggregation 1

  • 效果 1:带宽叠加,2 条千兆链路合在一起负载分担流量
  • 效果 2:链路冗余,断掉一根线,剩下一根自动顶上,网络不会断流,PC 之间 ping 不会中断

关键点:所有 VLAN、Trunk 配置,只需要在聚合口 BAGG1 下配置,物理端口会自动同步继承配置,不用分别在 GE1/0/1、GE1/0/2 敲 trunk 命令,这也是 H3C 交换机链路聚合的核心规则。

posted @ 2026-08-28 17:27  glücklich  阅读(8)  评论(0)    收藏  举报