I'm trying to configure on Linux bonding active-backup (2 physical interfaces eth2 and eth3, one is used) but also with two VLANs, and later connect it to internal bridges. I see two options for connections, both are working,
- First method works fine and looks easy, but all VLANs are routed through single physical interface (lower bandwidth)
- The second is problematic (for me), but I prefer this second, because it allows to route one VLAN through eth2, and second VLAN through eth3 (greater bandwidth with fault-tolerant).
- I don't want
bond-mode 4 = 802.3adAKA LACP (servers are connected to different Cisco switches, I have heard and seen some problems with such configurations), so
bond-mode active-backupneed to be enough.
# 1. Two NICs agregated to one bonding, and then separate VLANS from bonding interface: eth2 bond1.10 - xenbr10 > bond1 < eth3 bond1.15 - xenbr15 # 2. VLANs separated form physical NIC, then aggregate to separate binding interfaces. eth2.15 ... eth2 < eth2.10 > bond10 - xenbr10 eth3.10 eth3 < eth3.15 ...
I have server with Debian 11, 2 network interfaces, installed packages
ifenslave (in version 2.13 from testing repo, due to this problem from 2.12). Modules
bonding are loaded in system.
Question 1: Is first option of connection best-practices here? And why? I'm asking, because most (or maybe all) tutorials found on internet is about first connection (even Debian Wiki)
This is working fine, I can do it both from console or by config file. Downside of this: both VLANs are sent always using single interface. My current
/etc/network/interfaces (non-important elements removed)
iface eth2 inet manual iface eth3 inet manual auto bond1 iface bond1 inet manual bond-slaves eth2 eth3 bond-mode active-backup bond-miimon 100 bond-downdelay 200 bond-updelay 200 iface bond1.10 inet manual vlan-raw-device bond1 iface bond1.15 inet manual vlan-raw-device bond1 auto xenbr10 iface xenbr10 inet static address 22.214.171.124/24 bridge_ports bond1.10
After rebooting system this config is working correct, but I would like to configure and use second option.
Option 2: works from shell, unable to do from config file
I can do this configuration from the command line:
ifconfig eth2 up ifconfig eth3 up #setting up VLANs ip link add link eth2 name eth2.10 type vlan id 10 ip link add link eth3 name eth3.10 type vlan id 10 #creating bonding interface with 2 slaves NIC ip link add name bond1 type bond mode active-backup ip link set dev eth2.10 down ip link set dev eth3.10 down ip link set master bond10 dev eth2.10 ip link set master bond10 dev eth3.10 ip link set up dev bond10 ip link set dev eth2.10 up ip link set dev eth3.10 up ### Bridge + bonding brctl addbr xenbr10 brctl addif xenbr10 bond10 ip addr add 126.96.36.199/24 dev xenbr10 ip link set dev xenbr10 up
And network is up:
cat /proc/net/bonding/bond10 Ethernet Channel Bonding Driver: v5.10.0-12-amd64 Bonding Mode: fault-tolerance (active-backup) Primary Slave: None Currently Active Slave: eth2.10 MII Status: up (..) Slave Interface: eth2.10 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: (..) Slave Interface: eth3.10 MII Status: up (..)
But I'cant create config file to make this permanent. I tried many options like this, but with no luck. If i connect interface
eth2.10 directly to some
xenbr10 it works.
iface eth2.10 inet manual vlan-raw-device eth2 iface eth3.10 inet manual vlan-raw-device eth3 bond-master bond10 #It doesn't change nothing, for testing auto bond10 iface bond10 inet manual bond-slaves eth2.10 eth3.10 #bond-slaves none bond-mode active-backup bond-miimon 100 bond-downdelay 200 bond-updelay 200 auto xenbr10 iface xenbr10 inet static address 188.8.131.52/24 bridge_ports bond1.10
After rebooting system, usually I get errors like this:
ifup: Failed to enslave eth2.10 to bond10. Is bond10 ready and a bonding interface ?
Question 2: What is wrong with this config? I've tried
- set eth2.10 config above or below the bond10 configuration,
bond-master bond10entry for eth2.10 and
bond-slaves nonein bond10 config part
bond-slaves eth2.10 eth3.10entry in