Diese Anleitung beschreibt die Konfiguration von zwei LACP-Bonds unter Red Hat Enterprise Linux mit NetworkManager und nmcli.
Ziel:
| 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.
dnf install -y NetworkManager iproute ethtool
systemctl enable --now NetworkManager
Status prüfen:
nmcli dev status
nmcli con show
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.
bond12 erstellennmcli 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
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
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
bond12 erstellennmcli con add type vlan con-name bond12.129 ifname bond12.129 \
vlan.parent bond12 \
vlan.id 129 \
ipv4.method disabled \
ipv6.method ignore
bond34 erstellennmcli 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
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
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
bond34 erstellennmcli con add type vlan con-name bond34.330 ifname bond34.330 \
vlan.parent bond34 \
vlan.id 330 \
ipv4.method disabled \
ipv6.method ignore
bond34 erstellennmcli con add type vlan con-name bond34.380 ifname bond34.380 \
vlan.parent bond34 \
vlan.id 380 \
ipv4.method disabled \
ipv6.method ignore
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
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
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
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.
nmcli con show --active
nmcli dev status
ip -br addr
ip route
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
ip -d link show bond12.129
ip -d link show bond34.330
ip -d link show bond34.380
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"
Auf älteren RHEL-Versionen funktionieren port-type und controller eventuell nicht.
Dann können die Bond-Ports mit master und slave-type angelegt werden.
bond12nmcli 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
bond34nmcli 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
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
Prüfen:
ip -d link show bond12.129
ip -d link show bond34.330
ip -d link show bond34.380
Außerdem prüfen:
Prüfen:
cat /proc/net/bonding/bond12
cat /proc/net/bonding/bond34
Wichtig:
802.3ad nutztDie 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.