RHEL: LACP Bonding mit getaggten VLANs
Diese Anleitung beschreibt die Konfiguration von zwei LACP-Bonds unter Red Hat Enterprise Linux mit NetworkManager und nmcli.
Ziel:
- Port 1 + 2 bilden einen LACP-Bond für VLAN 129
- Port 3 + 4 bilden einen LACP-Bond für VLAN 330 und VLAN 380
- Die Bonds selbst bekommen keine IP-Konfiguration
- Die IP-Konfiguration erfolgt nur auf den VLAN-Interfaces
- Die VLANs sind am Switch getaggt konfiguriert
Zielbild
| Physische Ports | Bond | VLANs | VLAN-Interfaces |
|---|---|---|---|
| Port 1 + 2 | bond12 |
129 |
bond12.129 |
| Port 3 + 4 | bond34 |
330, 380 |
bond34.330, bond34.380 |
Beispielhafte Interface-Namen:
ens1f0
ens1f1
ens2f0
ens2f1
Die Namen müssen an das jeweilige System angepasst werden.
Pakete installieren
dnf install -y NetworkManager iproute ethtool
systemctl enable --now NetworkManager
Status prüfen:
nmcli dev status
nmcli con show
Wichtige Hinweise vorab
Die Bonds selbst werden ohne IP-Adresse konfiguriert.
ipv4.method disabled
ipv6.method ignore
Die IP-Adresse wird später nur auf dem VLAN-Interface gesetzt, zum Beispiel auf:
bond12.129
bond34.330
bond34.380
Außerdem müssen die Ethernet-/Port-Profile, die in den Bond aufgenommen werden, aktivierbar sein.
Wichtig sind daher diese Einstellungen:
connection.autoconnect yes
connection.autoconnect-ports 1
Wenn die Port-Profile nicht automatisch aktiviert werden dürfen, bleiben die Adapter im Bond gerne inaktiv oder tauchen nicht sauber als aktive Bond-Ports auf.
Bond 1: Port 1 + 2 für VLAN 129
Bond bond12 erstellen
nmcli con add type bond con-name bond12 ifname bond12 \
bond.options "mode=802.3ad,miimon=100,lacp_rate=fast,xmit_hash_policy=layer2+3" \
ipv4.method disabled \
ipv6.method ignore
Ethernet-Ports zum Bond hinzufügen
Beispiel mit ens1f0 und ens1f1:
nmcli con add type ethernet con-name bond12-p1 ifname ens1f0 \
port-type bond controller bond12
nmcli con add type ethernet con-name bond12-p2 ifname ens1f1 \
port-type bond controller bond12
Autoconnect für Bond und Ports setzen
Das ist wichtig, damit die Ethernet-Adapter im Bond auch aktiv werden.
nmcli con mod bond12 connection.autoconnect yes
nmcli con mod bond12 connection.autoconnect-ports 1
nmcli con mod bond12-p1 connection.autoconnect yes
nmcli con mod bond12-p2 connection.autoconnect yes
VLAN 129 auf bond12 erstellen
nmcli con add type vlan con-name bond12.129 ifname bond12.129 \
vlan.parent bond12 \
vlan.id 129 \
ipv4.method disabled \
ipv6.method ignore
Bond 2: Port 3 + 4 für VLAN 330 und 380
Bond bond34 erstellen
nmcli con add type bond con-name bond34 ifname bond34 \
bond.options "mode=802.3ad,miimon=100,lacp_rate=fast,xmit_hash_policy=layer2+3" \
ipv4.method disabled \
ipv6.method ignore
Ethernet-Ports zum Bond hinzufügen
Beispiel mit ens2f0 und ens2f1:
nmcli con add type ethernet con-name bond34-p1 ifname ens2f0 \
port-type bond controller bond34
nmcli con add type ethernet con-name bond34-p2 ifname ens2f1 \
port-type bond controller bond34
Autoconnect für Bond und Ports setzen
Auch hier wichtig, damit die Ethernet-Adapter im Bond aktiv werden.
nmcli con mod bond34 connection.autoconnect yes
nmcli con mod bond34 connection.autoconnect-ports 1
nmcli con mod bond34-p1 connection.autoconnect yes
nmcli con mod bond34-p2 connection.autoconnect yes
VLAN 330 auf bond34 erstellen
nmcli con add type vlan con-name bond34.330 ifname bond34.330 \
vlan.parent bond34 \
vlan.id 330 \
ipv4.method disabled \
ipv6.method ignore
VLAN 380 auf bond34 erstellen
nmcli con add type vlan con-name bond34.380 ifname bond34.380 \
vlan.parent bond34 \
vlan.id 380 \
ipv4.method disabled \
ipv6.method ignore
Verbindungen aktivieren
nmcli con up bond12
nmcli con up bond12-p1
nmcli con up bond12-p2
nmcli con up bond12.129
nmcli con up bond34
nmcli con up bond34-p1
nmcli con up bond34-p2
nmcli con up bond34.330
nmcli con up bond34.380
Falls ein Port nicht aktiv wird, gezielt prüfen:
nmcli con show bond12-p1
nmcli con show bond12-p2
nmcli con show bond34-p1
nmcli con show bond34-p2
Gegebenenfalls erneut setzen:
nmcli con mod bond12-p1 connection.autoconnect yes
nmcli con mod bond12-p2 connection.autoconnect yes
nmcli con mod bond34-p1 connection.autoconnect yes
nmcli con mod bond34-p2 connection.autoconnect yes
Beispiel: IP-Adressen auf VLANs setzen
VLAN 129 mit Default-Gateway
nmcli con mod bond12.129 \
ipv4.method manual \
ipv4.addresses 10.129.0.10/24 \
ipv4.gateway 10.129.0.1 \
ipv4.dns 10.129.0.53 \
ipv6.method ignore
nmcli con up bond12.129
VLAN 330 ohne Default-Gateway
nmcli con mod bond34.330 \
ipv4.method manual \
ipv4.addresses 10.330.0.10/24 \
ipv4.never-default yes \
ipv6.method ignore
nmcli con up bond34.330
VLAN 380 ohne Default-Gateway
nmcli con mod bond34.380 \
ipv4.method manual \
ipv4.addresses 10.380.0.10/24 \
ipv4.never-default yes \
ipv6.method ignore
nmcli con up bond34.380
Wichtig:
Nicht auf mehreren VLAN-Interfaces blind ein Default-Gateway setzen.
In der Regel bekommt nur das Management- oder Default-Netz ein Gateway. Weitere VLANs bekommen entweder kein Gateway oder nur gezielte statische Routen.
Prüfung
Aktive Verbindungen anzeigen
nmcli con show --active
Geräte anzeigen
nmcli dev status
IP-Adressen prüfen
ip -br addr
Routing prüfen
ip route
Bond-Status prüfen
cat /proc/net/bonding/bond12
cat /proc/net/bonding/bond34
Wichtig ist hier unter anderem:
Bonding Mode: IEEE 802.3ad Dynamic link aggregation
MII Status: up
Slave Interface: ens1f0
Slave Interface: ens1f1
Bei bond34 entsprechend:
Bonding Mode: IEEE 802.3ad Dynamic link aggregation
MII Status: up
Slave Interface: ens2f0
Slave Interface: ens2f1
VLAN-Interfaces prüfen
ip -d link show bond12.129
ip -d link show bond34.330
ip -d link show bond34.380
Link-Status der physischen Adapter prüfen
ethtool ens1f0 | egrep "Speed|Duplex|Link detected"
ethtool ens1f1 | egrep "Speed|Duplex|Link detected"
ethtool ens2f0 | egrep "Speed|Duplex|Link detected"
ethtool ens2f1 | egrep "Speed|Duplex|Link detected"
Fallback für ältere RHEL-Versionen
Auf älteren RHEL-Versionen funktionieren port-type und controller eventuell nicht.
Dann können die Bond-Ports mit master und slave-type angelegt werden.
Beispiel für bond12
nmcli con add type ethernet con-name bond12-p1 ifname ens1f0 \
master bond12 slave-type bond
nmcli con add type ethernet con-name bond12-p2 ifname ens1f1 \
master bond12 slave-type bond
nmcli con mod bond12 connection.autoconnect-slaves 1
nmcli con mod bond12-p1 connection.autoconnect yes
nmcli con mod bond12-p2 connection.autoconnect yes
Beispiel für bond34
nmcli con add type ethernet con-name bond34-p1 ifname ens2f0 \
master bond34 slave-type bond
nmcli con add type ethernet con-name bond34-p2 ifname ens2f1 \
master bond34 slave-type bond
nmcli con mod bond34 connection.autoconnect-slaves 1
nmcli con mod bond34-p1 connection.autoconnect yes
nmcli con mod bond34-p2 connection.autoconnect yes
Typische Fehler
Bond ist da, aber Ports sind nicht aktiv
Prüfen:
nmcli con show --active
cat /proc/net/bonding/bond12
cat /proc/net/bonding/bond34
Lösung:
nmcli con mod bond12 connection.autoconnect yes
nmcli con mod bond12 connection.autoconnect-ports 1
nmcli con mod bond12-p1 connection.autoconnect yes
nmcli con mod bond12-p2 connection.autoconnect yes
nmcli con mod bond34 connection.autoconnect yes
nmcli con mod bond34 connection.autoconnect-ports 1
nmcli con mod bond34-p1 connection.autoconnect yes
nmcli con mod bond34-p2 connection.autoconnect yes
Danach neu aktivieren:
nmcli con up bond12
nmcli con up bond12-p1
nmcli con up bond12-p2
nmcli con up bond34
nmcli con up bond34-p1
nmcli con up bond34-p2
VLAN ist da, aber keine Kommunikation
Prüfen:
ip -d link show bond12.129
ip -d link show bond34.330
ip -d link show bond34.380
Außerdem prüfen:
- Ist das VLAN am Switch getaggt?
- Ist der LACP-Port-Channel am Switch korrekt aktiv?
- Stimmen die VLAN-IDs?
- Ist die IP-Adresse auf dem VLAN-Interface gesetzt und nicht auf dem Bond?
- Gibt es nur ein korrektes Default-Gateway?
LACP kommt nicht hoch
Prüfen:
cat /proc/net/bonding/bond12
cat /proc/net/bonding/bond34
Wichtig:
- Switch-Seite muss LACP aktiv haben
- Kein statischer EtherChannel, wenn Linux
802.3adnutzt - Beide Ports eines Bonds müssen im selben Switch-Port-Channel liegen
- VLAN-Tagging muss auf dem Port-Channel konfiguriert sein, nicht nur auf den Einzelports
Kurzfassung
Die eigentliche Logik ist:
Physische NICs → LACP Bond → VLAN-Interface → IP-Adresse
Also zum Beispiel:
ens1f0 + ens1f1 → bond12 → bond12.129 → IP-Adresse
ens2f0 + ens2f1 → bond34 → bond34.330 / bond34.380 → IP-Adresse
Die Bonds selbst bleiben ohne IP-Adresse.
Die VLAN-Interfaces bekommen die IP-Konfiguration.
Die Bond-Ports müssen autoconnect yes haben, sonst werden sie nicht zuverlässig aktiv.