---
title: "EtherChannel — LACP & PAgP"
domain: network
subdomain: switching
type: snippet
tags: [etherchannel, lacp, pagp, cisco, bonding, link-aggregation, 802.3ad]
difficulty: intermediate
status: stable
updated: "2025-05-14"
---
## Concepts

```
EtherChannel = agrégation de liens physiques en un lien logique unique
Noms équivalents : LAG (Link Aggregation Group), bonding (Linux), 802.3ad (LACP)

Avantages :
  - Bande passante cumulée (2×1G = 2 Gbps logique)
  - Redondance : si un lien tombe, le traffic bascule sur les autres sans convergence STP
  - STP voit un seul lien logique → pas de port bloqué

Protocoles de négociation :
  LACP (802.3ad) : standard IEEE, interopérable — RECOMMANDÉ
  PAgP           : propriétaire Cisco, à éviter sur infra multi-vendor
  Static (on)    : pas de négociation — risque de boucle si mal configuré

Modes LACP :
  active   : initie la négociation LACP (recommandé)
  passive  : attend la négociation de l'autre côté
  → active/active ou active/passive fonctionnent ; passive/passive = pas de channel

Modes PAgP :
  desirable : initie la négociation PAgP
  auto      : attend la négociation de l'autre côté
  → desirable/desirable ou desirable/auto fonctionnent

Limite : max 8 ports actifs par EtherChannel Cisco (+ 8 en standby avec LACP)
```

## Configuration Cisco — LACP (L2)

### EtherChannel L2 entre deux switches

```text
! ── Sur SW1 ──────────────────────────────────────────
conf t
interface range GigabitEthernet0/1-2
 ! Prérequis : même speed, duplex, mode (access ou trunk) sur tous les ports
 switchport mode trunk
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30
 channel-group 1 mode active      ! LACP active
 no shutdown

! L'interface logique Po1 est créée automatiquement
interface Port-channel1
 description ** EtherChannel vers SW2 **
 switchport mode trunk
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30

! ── Sur SW2 ──────────────────────────────────────────
conf t
interface range GigabitEthernet0/1-2
 switchport mode trunk
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30
 channel-group 1 mode active      ! active/active = OK avec LACP
 no shutdown

interface Port-channel1
 description ** EtherChannel vers SW1 **
 switchport mode trunk
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30
```

### EtherChannel L2 access (vers serveur)

```text
conf t
interface range GigabitEthernet0/3-4
 switchport mode access
 switchport access vlan 20
 channel-group 2 mode active
 no shutdown

interface Port-channel2
 description ** Bond vers Serveur Linux **
 switchport mode access
 switchport access vlan 20
```

## Configuration Cisco — PAgP

```text
conf t
interface range GigabitEthernet0/1-2
 switchport mode trunk
 switchport trunk encapsulation dot1q
 channel-group 1 mode desirable   ! PAgP desirable
 no shutdown
```

## Configuration Cisco — Static (on/on)

```text
! ATTENTION : mode "on" = pas de négociation
! Si un côté est "on" et l'autre est en LACP/PAgP → boucle potentielle
! Utiliser uniquement en lab ou si le protocole de négociation ne fonctionne pas

conf t
interface range GigabitEthernet0/1-2
 channel-group 1 mode on
 no shutdown
```

## EtherChannel L3 (routed)

```text
! Sur un switch L3 ou routeur — EtherChannel sans switchport (lien routé)
conf t
interface range GigabitEthernet1/0/1-2
 no switchport                    ! mode routed
 channel-group 1 mode active
 no shutdown

interface Port-channel1
 description ** L3 EtherChannel vers Core **
 no switchport
 ip address {{L3_EC_IP}} {{L3_EC_MASK}}
 no shutdown
```

## Load balancing

```text
! Algorithme de répartition du trafic sur les membres du channel
! Changer selon le type de trafic dominant

conf t
! Options disponibles (selon plateforme) :
!   dst-ip, dst-mac, src-dst-ip, src-dst-mac, src-dst-port, src-ip, src-mac
port-channel load-balance src-dst-ip      ! recommandé pour trafic IP mixte
port-channel load-balance src-dst-mac     ! utile si peu d'IPs différentes
port-channel load-balance src-dst-port    ! pour flux TCP/UDP variés

! Vérifier l'algorithme actuel
show etherchannel load-balance

! Tester la répartition (hash) pour un flux donné
test etherchannel load-balance interface Port-channel1 ip {{SRC_IP}} {{DST_IP}}
```

## Vérifications

```text
! Vue résumée de tous les EtherChannels
show etherchannel summary

! Exemple de sortie :
! Group  Port-channel  Protocol    Ports
! ------+-------------+-----------+------------------------------------------
! 1      Po1(SU)       LACP        Gi0/1(P)   Gi0/2(P)
!   SU = layer2, in use  |  P = bundled in port-channel

! Détail complet (états LACP, timeouts, PDUs)
show etherchannel 1 detail

! État de l'interface Port-channel
show interfaces Port-channel1
show interfaces Port-channel1 trunk

! Membres d'un channel
show etherchannel 1 port-channel

! Conteurs LACP
show lacp 1 internal
show lacp 1 neighbor
show lacp counters
```

## Troubleshooting

```text
! Problèmes courants :
! 1. Modes incompatibles → vérifier active/passive ou desirable/auto
! 2. VLAN mismatch → les ports membres doivent avoir les mêmes VLANs autorisés
! 3. Speed/duplex mismatch → tous les membres doivent être identiques
! 4. STP → Port-channel doit hériter la config STP, pas les ports individuels
! 5. Native VLAN différent → show interfaces trunk sur les deux côtés

! Diagnostic
show interfaces GigabitEthernet0/1 status    ! vérifier speed/duplex
show interfaces trunk                         ! vérifier VLAN allowed
show spanning-tree                            ! vérifier que Po1 est visible
debug lacp packet                             ! voir les PDUs LACP (lab uniquement)

! Réinitialiser un EtherChannel
conf t
interface range GigabitEthernet0/1-2
 no channel-group 1
interface range GigabitEthernet0/1-2
 channel-group 1 mode active
```

## Linux Bonding (équivalent)

### Debian/Ubuntu — `/etc/network/interfaces`

```bash
# Installer le paquet bonding si besoin
apt install ifenslave

# /etc/network/interfaces
auto bond0
iface bond0 inet static
    address {{BOND_IP}}
    netmask {{BOND_MASK}}
    gateway {{BOND_GW}}
    bond-slaves eth0 eth1
    bond-mode 802.3ad          # LACP
    bond-miimon 100            # check liaison toutes les 100ms
    bond-lacp-rate fast        # LACP PDU toutes les 1s (défaut = slow = 30s)
    bond-xmit-hash-policy layer3+4  # load-balance src-dst IP+port
```

### systemd-networkd

```bash
# /etc/systemd/network/10-bond0.netdev
[NetDev]
Name=bond0
Kind=bond

[Bond]
Mode=802.3ad
MIIMonitorSec=100ms
LACPTransmitRate=fast
TransmitHashPolicy=layer3+4

# /etc/systemd/network/20-bond0-slave.network  (répéter pour eth1)
[Match]
Name=eth0

[Network]
Bond=bond0

# /etc/systemd/network/30-bond0.network
[Match]
Name=bond0

[Network]
Address={{BOND_IP}}/{{PREFIX}}
Gateway={{BOND_GW}}
```

### Vérification Linux

```bash
cat /proc/net/bonding/bond0        # état détaillé (mode, membres, actif)
ip link show bond0
ethtool bond0
```

<Tip>
Tous les ports membres d'un EtherChannel doivent avoir une configuration identique : même speed, duplex, mode (access/trunk), VLANs autorisés et native VLAN. Un seul port avec une config différente empêche le channel de monter. Sur Cisco, `show etherchannel summary` affichera le port avec le flag "s" (suspended) ou "D" (down) au lieu de "P" (bundled).
</Tip>
