MHuiG

「看庭前花开花落,望天上云卷云舒」

以太网链路聚合

# 以太网链路聚合

## 链路聚合

以太捆绑端口聚合，是将多台以太链路捆绑成一条逻辑链路，从而实现带宽的增加和链路的冗余，提高网络可靠性.

## 链路聚合优点

链路聚合能够提高链路带宽：理论上通过聚合几条链路，一个聚合组的带宽可以扩展为被绑定链路带宽总和，有效的增加了逻辑链路带宽.

网络可靠性：配置链路聚合后，如果某一条链路失效，那么聚合的其他链路依旧可以转发数据.

支持负载均衡：一个聚合组可以把流量分散到不同的被聚合的物理链路上，通过多个链路将数据发送到同一个目的地，将网络拥塞的可能降低.

链路聚合分为动态协商聚合和手工聚合.

## 手工聚合

手工聚合只要接口被加入到聚合组中，那么接口的状态就会 UP, 只关心自己到对端的状态，不关心对端设备的状态，如果对端设备出现故障，本端设备依旧认为对端的端口 UP, 但是不知道对端已经不具备转发能力.

## 动态聚合

动态聚合: LACP 模式，聚合组中存在活动链路和非活动链路，在 LACP 模式下，会选举主动端和被动端，被动端根据主动端选举出来的活跃接口来确定自己对应的活跃接口.

主动端和被动端选举:

1. 根据设备的优先级选举，优先级数值越小越优先，默认 32768.

2. 如果优先级相同，则比较设备的 MAC 地址，MAC 地址越小越优

活跃链路选举:

1. 当设备通过命令设置了活跃链路数量，会根据接口的优先级进行活跃链路选举，优先级越小越优，32768.

2. 如果优先级相同，则比较端口号，数值越小越优.

## Shell

### 手工聚合

SW1

    [SW1]int Eth-Trunk
    [SW1]int Eth-Trunk ?
      <0-63>  Eth-Trunk interface number

    [SW1]int Eth-Trunk 12
    [SW1-Eth-Trunk12]trunkport g 0/0/1 to 0/0/4
    [SW1]display interface Eth-Trunk 12
    Eth-Trunk12 current state : UP
    Line protocol current state : UP
    Description:
    Switch Port, PVID :    1, Hash arithmetic : According to SIP-XOR-DIP,Maximal BW:
     4G, Current BW: 4G, The Maximum Frame Length is 9216
    IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc7c-1cd9
    Current system time: 2024-01-08 11:57:24-08:00
        Input bandwidth utilization  :    0%
        Output bandwidth utilization :    0%
    -----------------------------------------------------
    PortName                      Status      Weight
    -----------------------------------------------------
    GigabitEthernet0/0/1          UP          1
    GigabitEthernet0/0/2          UP          1
    GigabitEthernet0/0/3          UP          1
    GigabitEthernet0/0/4          UP          1
    -----------------------------------------------------
    The Number of Ports in Trunk : 4
    The Number of UP Ports in Trunk : 4

SW2

    [SW2]int Eth-Trunk 12
    [SW2-Eth-Trunk12]trunkport g 0/0/1 to 0/0/4

### 动态聚合

SW3

    [SW3]int Eth-Trunk 34
    [SW3-Eth-Trunk34]mode lacp-static
    [SW3-Eth-Trunk34]trunkport g 0/0/1 to 0/0/4
    [SW3-Eth-Trunk34]max active-linknumber 2

SW4

    [SW4]int Eth-Trunk 34
    [SW4-Eth-Trunk34]mode lacp-static
    [SW4-Eth-Trunk34]trunkport g 0/0/1 to 0/0/4
    [SW4-Eth-Trunk34]max active-linknumber 2
    [SW4-Eth-Trunk34]dis th
    #
    interface Eth-Trunk34
     mode lacp-static
     max active-linknumber 2
    #
    [SW4-Eth-Trunk34]display interface Eth-Trunk 34
    Eth-Trunk34 current state : UP
    Line protocol current state : UP
    Description:
    Switch Port, PVID :    1, Hash arithmetic : According to SIP-XOR-DIP,Maximal BW:
     4G, Current BW: 2G, The Maximum Frame Length is 9216
    IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc43-7170
    Current system time: 2024-01-08 12:28:39-08:00
        Input bandwidth utilization  :    0%
        Output bandwidth utilization :    0%
    -----------------------------------------------------
    PortName                      Status      Weight
    -----------------------------------------------------
    GigabitEthernet0/0/1          UP          1
    GigabitEthernet0/0/2          UP          1
    GigabitEthernet0/0/3          DOWN        1
    GigabitEthernet0/0/4          DOWN        1
    -----------------------------------------------------
    The Number of Ports in Trunk : 4
    The Number of UP Ports in Trunk : 2

    [SW4-Eth-Trunk34]

接口优先级

    [SW3]lacp priority ?
      INTEGER<0-65535>  Priority value, the default value is 32768
    [SW3]lacp priority 20

    [SW3]int g0/0/3
    [SW3-GigabitEthernet0/0/3]lacp priority 32769
    [SW3-GigabitEthernet0/0/3]dis int Eth-Trunk 34
    Eth-Trunk34 current state : UP
    Line protocol current state : UP
    Description:
    Switch Port, PVID :    1, Hash arithmetic : According to SIP-XOR-DIP,Maximal BW:
     4G, Current BW: 2G, The Maximum Frame Length is 9216
    IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc28-2c9f
    Current system time: 2024-01-08 13:54:30-08:00
        Input bandwidth utilization  :    0%
        Output bandwidth utilization :    0%
    -----------------------------------------------------
    PortName                      Status      Weight
    -----------------------------------------------------
    GigabitEthernet0/0/1          UP          1
    GigabitEthernet0/0/2          UP          1
    GigabitEthernet0/0/3          DOWN        1
    GigabitEthernet0/0/4          DOWN        1
    -----------------------------------------------------
    The Number of Ports in Trunk : 4
    The Number of UP Ports in Trunk : 2

    [SW3-GigabitEthernet0/0/3]int g0/0/2
    [SW3-GigabitEthernet0/0/2]shutdown
    [SW3-GigabitEthernet0/0/2]
    [SW3-GigabitEthernet0/0/2]dis int Eth-Trunk 34
    Eth-Trunk34 current state : UP
    Line protocol current state : UP
    Description:
    Switch Port, PVID :    1, Hash arithmetic : According to SIP-XOR-DIP,Maximal BW:
     4G, Current BW: 2G, The Maximum Frame Length is 9216
    IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc28-2c9f
    Current system time: 2024-01-08 13:54:57-08:00
        Input bandwidth utilization  :    0%
        Output bandwidth utilization :    0%
    -----------------------------------------------------
    PortName                      Status      Weight
    -----------------------------------------------------
    GigabitEthernet0/0/1          UP          1
    GigabitEthernet0/0/2          DOWN        1
    GigabitEthernet0/0/3          DOWN        1
    GigabitEthernet0/0/4          UP          1
    -----------------------------------------------------
    The Number of Ports in Trunk : 4
    The Number of UP Ports in Trunk : 2

    [SW3-GigabitEthernet0/0/2]

    [SW3]display Eth-Trunk 34
    Eth-Trunk34's state information is:
    Local:
    LAG ID: 34                  WorkingMode: STATIC
    Preempt Delay: Disabled     Hash arithmetic: According to SIP-XOR-DIP
    System Priority: 20         System ID: 4c1f-cc28-2c9f
    Least Active-linknumber: 1  Max Active-linknumber: 2
    Operate status: up          Number Of Up Port In Trunk: 2
    --------------------------------------------------------------------------------
    ActorPortName          Status   PortType PortPri PortNo PortKey PortState Weight
    GigabitEthernet0/0/1   Selected 1GE      32768   2      8753    10111100  1
    GigabitEthernet0/0/2   Unselect 1GE      32768   3      8753    10100010  1
    GigabitEthernet0/0/3   Selected 1GE      32769   4      8753    10111100  1
    GigabitEthernet0/0/4   Unselect 1GE      32768   5      8753    10100000  1

    Partner:
    --------------------------------------------------------------------------------
    ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
    GigabitEthernet0/0/1   32768    4c1f-cc43-7170  32768   2      8753    10111100
    GigabitEthernet0/0/2   0        0000-0000-0000  0       0      0       10100011
    GigabitEthernet0/0/3   32768    4c1f-cc43-7170  32768   4      8753    10111100
    GigabitEthernet0/0/4   32768    4c1f-cc43-7170  32768   5      8753    10110000

STP

STP STP STPSTP: 生成树协议，在以太网中，通过阻塞部分链路形成树状结构，从而消除网络中的环路结构，当主链路发生故障时，被阻塞的链路可以自行恢复转发状态，从而保证网络中链路...

ACL原理和配置

ACL 原理和配置 ACL 原理和配置 ACLACL: 访问控制列表，可以对数据，报文流量进行过滤控制访问的一种工具. ACL 分类1. 基本 ACL: 2000-2999 可以根据报...

推荐阅读
实现VLAN间通信 数据转发过程 VLAN原理与配置 IP路由基础 STP OSPF基础

留言区

Notes
数据通信网络
<pjax>
</pjax>
<pjax></pjax>
<pjax> Are You A Robot?</pjax>