链路聚合实验(PT模拟器)

本文介绍了链路聚合的概念、优点以及两种常见的实现方式——LACP(IEEE802.3ad)和PAGP。通过配置示例详细阐述了如何在交换机上设置链路聚合,包括LACP协议的启用、端口设置和聚合端口的管理。同时,讨论了手工模式下链路聚合的配置步骤,并展示了如何检查聚合链路的状态。最后,对比了LACP和PAGP协议的开放性和适用性差异。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

链路聚合:

链路聚合:

链路聚合 (Link Aggregation),也称为端口捆绑、端口聚集或链路聚集,链路聚合是将多个端口聚合在一起形成1个汇聚组,以实现出/入负荷在各成员端口中的分担。从外面看起来,1个汇聚组好像就是1个端口。

优点:

提高链路带宽

提高可靠性:同组成员彼此动态备份

要求:

加入链路聚合的端口的带宽,速度,vlan等设置都要一样

链路聚合手工模式LACPPAGP
名称链路聚合控制协议(IEEE802.3ad)端口聚合协议
开放性开放标准思科私有
标准Etherchannel and IEEE 802.3adEtherchannel
模式Static On ModeActive/PassiveAuto/Desirable

SW1和SW2的f0/20-f0/23作为链路聚合的端口,PC1和PC2作为vlan1互相通信:

https://s2.loli.net/2022/05/08/NoFb9XLlYGTP2fv.png

SW1:

Switch(config)#int range f 0/20-23  #设置f0/20-23端口四个端口设置LACP
Switch(config-if-range)#channel-protocol lacp #设置链路聚合控制协议为LACP(默认值),LACP为标准协议,pagp为思科私有
Switch(config-if-range)#switchport trunk encapsulation dot1q  #设置帧格式为dot1q,Pt模拟器只有在三层交换机支持,二层教交换机不支持
Switch(config-if-range)#switchport mode trunk  #设置为trunk模式
Switch(config-if-range)#channel-group 1 mode active  #设置指定端口组为1,信道ID为1,模式为active模式,两边只要至少一边时active模式即可

Switch(config-if)#int port-channel 1  #创建捆绑接口,就是用channel-group 1加入的相同ID的物理接口,捆绑成一个逻辑接口
Switch(config-if)#switchport trunk encapsulation dot1q #PT模拟器二层交换机不支持,可以不用设置
Switch(config-if)#switchport mode trunk  #设置捆绑接口为trunk模式
Switch(config-if)#switchport trunk allowed  vlan all #trunk默认允许所有vlan通过
Switch(config)#show interfaces port-channel 1  #查看捆绑端口的信息,三层交换机可以查看

SW2也是同样的配置:

SW1:

Switch(config)#int range f 0/20-23 
Switch(config-if-range)#switchport trunk encapsulation dot1q  
Switch(config-if-range)#switchport mode trunk
Switch(config-if-range)#channel-group 1 mode active

Switch(config-if)#int port-channel 1  #创建捆绑接口,就是用channel-group 1加入的相同ID的物理接口,捆绑成一个逻辑接口
Switch(config-if)#switchport trunk encapsulation dot1q #PT模拟器二层交换机不支持,可以不用设置
Switch(config-if)#switchport mode trunk  #设置捆绑接口为trunk模式
Switch(config-if)#switchport trunk allowed  vlan all #trunk默认允许所有vlan通过

查看端口通道信息:

https://s2.loli.net/2022/05/08/Xmg7BGSby5a8kiK.png

Switch#show etherchannel port-channel 
                Channel-group listing:
                ----------------------

Group: 1
----------
                Port-channels in the group:
                ---------------------------

Port-channel: Po1    (Primary Aggregator)
------------

Age of the Port-channel   = 00d:04h:03m:59s
Logical slot/port   = 2/1       Number of ports = 4
GC                  = 0x00000000      HotStandBy port = null
Port state          = Port-channel 
Protocol            =   LACP
Port Security       = Disabled

Ports in the Port-channel:

Index   Load   Port     EC state        No of bits
------+------+------+------------------+-----------
  0     00     Fa0/23   Active             0
  0     00     Fa0/20   Active             0
  0     00     Fa0/21   Active             0
  0     00     Fa0/22   Active             0
Time since last port bundled:    00d:04h:02m:35s    Fa0/22
Switch#
Switch#

查看聚合链路状态:

Switch#show etherchannel summary
Flags:  D - down        P - in port-channel
        I - stand-alone s - suspended
        H - Hot-standby (LACP only)
        R - Layer3      S - Layer2
        U - in use      f - failed to allocate aggregator
        u - unsuitable for bundling
        w - waiting to be aggregated
        d - default port

Number of channel-groups in use: 1
Number of aggregators:           1

Group  Port-channel  Protocol    Ports
------+-------------+-----------+----------------------------------------------

1      Po1(SU)           LACP   Fa0/20(P) Fa0/21(P) Fa0/22(P) Fa0/23(P)

https://s2.loli.net/2022/05/08/rPOC1GVxjQfHYkU.png

两个PC互PING:

https://s2.loli.net/2022/05/08/EQpMlAr8SvJf9Ck.png

链路状态:

交换机之间的线路被捆绑成一个逻辑链路,不会被STP阻断,所有的链路都是开启状态。

https://s2.loli.net/2022/05/08/yYHKuhNf3Odvt6z.png

手工模式:

https://s2.loli.net/2022/05/08/DRgydN5rcZaPYfh.png

设置如图上所示

手工模式设置链路聚合,在设置好端口聚合之前要先把端口关闭,设置好之后再打开端口:

Switch(config)#int range f0/3-4
Switch(config-if-range)#shutdown
Switch(config-if-range)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINK-5-CHANGED: Interface FastEthernet0/2, changed state to administratively down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

Switch(config-if-range)#channel-group 1 mode on
Switch(config-if-range)#
Creating a port-channel interface Port-channel 1

Switch(config-if-range)#no shutdown 

Switch(config-if-range)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINK-5-CHANGED: Interface Port-channel1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up

%LINK-5-CHANGED: Interface FastEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

sw1:

查看链路信息:

Switch#show etherchannel summary 
Flags:  D - down        P - in port-channel
        I - stand-alone s - suspended
        H - Hot-standby (LACP only)
        R - Layer3      S - Layer2
        U - in use      f - failed to allocate aggregator
        u - unsuitable for bundling
        w - waiting to be aggregated
        d - default port

Number of channel-groups in use: 1
Number of aggregators:           1

Group  Port-channel  Protocol    Ports
------+-------------+-----------+----------------------------------------------

1      Po1(SU)           -      Fa0/1(P) Fa0/2(P)  p代表加入链路汇聚成功,H代表热备份,lacp最多支持8+8备份模式

查看汇聚端口:

Switch#show etherchannel port-channel 1
                Channel-group listing:
                ----------------------

Group: 1
----------
                Port-channels in the group:
                ---------------------------

Port-channel: Po1
------------

Age of the Port-channel   = 00d:00h:05m:01s
Logical slot/port   = 2/1       Number of ports = 2
GC                  = 0x00000000      HotStandBy port = null
Port state          = Port-channel 
Protocol            =   PAGP
Port Security       = Disabled

Ports in the Port-channel:

Index   Load   Port     EC state        No of bits
------+------+------+------------------+-----------
  0     00     Fa0/1    On                 0
  0     00     Fa0/2    On                 0
Time since last port bundled:    00d:00h:03m:40s    Fa0/2
Switch#

PAGP:

配置都一样,channel-protocol pagp #设置协议为PAGP协议

只要有一边设置成channel-group 1 mode Desirable,就可以组成聚合链路
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值