Debian 12 bookworm
Sponsored Link

Configure Network Bonding2023/07/17

 
Configure Network Bonding to bind multiple network interfaces into a single load balanced or fault-toleranced interface and so on.
There are some modes for configuring network bonding like follows.
Mode Mode Name Description
0 balance-rr Sets a round-robin policy for fault tolerance and load balancing.
Transmissions are received and sent out sequentially on each bonded member interface beginning with the first one available.
1 active-backup Sets an active-backup policy for fault tolerance.
Transmissions are received and sent out via the first available bonded member interface.
Another bonded member interface is only used if the active bonded member interface fails.
2 balance-xor Sets an XOR (exclusive-or) policy for fault tolerance and load balancing.
Using this method, the interface matches up the incoming request's MAC address with the MAC address for one of the member NICs.
Once this link is established, transmissions are sent out sequentially beginning with the first available interface.
3 broadcast Sets a broadcast policy for fault tolerance.
All transmissions are sent on all member interfaces.
4 802.3ad Sets an IEEE 802.3ad dynamic link aggregation policy.
Creates aggregation groups that share the same speed and duplex settings.
Transmits and receives on all members in the active aggregator. Requires a switch that is 802.3ad compliant.
5 balance-tlb Sets a Transmit Load Balancing (TLB) policy for fault tolerance and load balancing.
The outgoing traffic is distributed according to the current load on each member interface. Incoming traffic is received by the current member NIC.
If the receiving member fails, another member takes over the MAC address of the failed member.
6 balance-alb Sets an Active Load Balancing (ALB) policy for fault tolerance and load balancing.
Includes transmit and receive load balancing for IPV4 traffic.
Receive load balancing is achieved through ARP negotiation.

[1] Configure Network Bonding.
root@dlp:~#
apt -y install ifenslave ethtool
# confirm network interfaces

root@dlp:~#
ip address show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:1e:97:91 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.30/24 brd 10.0.0.255 scope global enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe1e:9791/64 scope link
       valid_lft forever preferred_lft forever
3: enp7s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 52:54:00:54:5f:34 brd ff:ff:ff:ff:ff:ff

# edit network settings

root@dlp:~#
vi /etc/network/interfaces
# change all like follows
# replace the interface name, IP address, DNS, Gateway to your environment value
# for [mode] section, set a mode you'd like to use
auto enp1s0
iface enp1s0 inet manual
    bond-master bond0
    bond-mode balance-rr
   
auto enp7s0
iface enp7s0 inet manual
    bond-master bond0
    bond-mode balance-rr

auto bond0
iface bond0 inet static
    address 10.0.0.30
    netmask 255.255.255.0
    network 10.0.0.0
    gateway 10.0.0.1
    bond-slaves enp1s0 enp7s0
    bond-mode balance-rr
    bond-miimon 100
    bond-downdelay 200
    bond-updelay 200

root@dlp:~#
ifdown enp1s0

root@dlp:~#
ifdown enp7s0

root@dlp:~#
ifup bond0
root@dlp:~#
ip address show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP group default qlen 1000
    link/ether 52:54:00:1e:97:91 brd ff:ff:ff:ff:ff:ff
3: enp7s0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP group default qlen 1000
    link/ether 52:54:00:1e:97:91 brd ff:ff:ff:ff:ff:ff permaddr 52:54:00:54:5f:34
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:1e:97:91 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.30/24 brd 10.0.0.255 scope global bond0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe1e:9791/64 scope link
       valid_lft forever preferred_lft forever

# after setting bonding, [bonding] is loaded automatically

root@dlp:~#
lsmod | grep bond

bonding               221184  0
tls                   126976  1 bonding

root@dlp:~#
ethtool bond0

Settings for bond0:
        Supported ports: [  ]
        Supported link modes:   Not reported
        Supported pause frame use: No
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 2000Mb/s
        Duplex: Full
        Auto-negotiation: off
        Port: Other
        PHYAD: 0
        Transceiver: internal
        Link detected: yes
Matched Content