~ read.

Nested Bonded Interfaces


Photo by Thomas Jensen / Unsplash

It can be helpful to bond physical network interfaces together on physicals hosts so that software can treat multiple network connections as a single interface to while spreading the load across all members. Linux, and Debian derivatives in particular benefit from a kernel module called ifenslave. It's referenced here: https://wiki.debian.org/Bonding.

I've used this for clustering storage systems, as well as VM/Container hosts to ensure consistent and fast network access. Here is some working examples below.

#
#  This is an example of /etc/network/interfaces
#  Reference this manpage for configuration options: https://www.kernel.org/doc/Documentation/networking/bonding.txt
#
#    It is important that the interfaces listed first are 
#    initialized first to last as described in the configuration file.
#    For Example to Create a logical interface(a) on top of another logical interface(b)
#    the logical interface(b) would need to already exist.
#

# Bonds Primary/Backup
auto bond0
iface bond0 inet manual
    up ifconfig bond0 up
    slaves eth1 eth3 eth5
    bond_mode 802.3ad
    bond_miimon 150
    bond_downdelay 200
    bond_updelay 200

auto bond1
iface bond1 inet manual
    up ifconfig bond1 up
    slaves eth0 eth2 eth4
    bond_mode 802.3ad
    bond_miimon 150
    bond_downdelay 200
    bond_updelay 200

# Bonded HA
auto bondha
iface bondha inet manual
    up ifconfig bondha up
    slaves bond0 bond1
    bond_mode active-backup
    bond_miimon 310
    bond_downdelay 200
    bond_updelay 200

# IPs in VLANs
auto bondha.1
iface bondha.1 inet static
        up ifconfig bondha.1 up
        address 10.0.1.1
        netmask 255.255.255.0
        vlan-raw-device bondha
        gateway 10.0.1.254
        dns-search pdx.atwlab.com
        dns-nameservers 8.8.8.8, 8.8.4.4, 10.0.1.254

auto bondha.100
iface bondha.100 inet static
        up ifconfig bondha.100 up
        address 10.0.100.1
        netmask 255.255.255.0
        vlan-raw-device bondha
        gateway 10.0.100.254
        dns-search pdx.atwlab.com
        dns-nameservers 8.8.8.8, 8.8.4.4, 10.0.100.254