Ubuntu 24.04
Sponsored Link

Configure Network Bonding2024/07/01

 
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.
# 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 noprefixroute
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:db:f8:fe brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.232/24 metric 100 brd 10.0.0.255 scope global dynamic enp1s0
       valid_lft 450sec preferred_lft 450sec
    inet6 fe80::5054:ff:fedb:f8fe/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:c3:d9:a2 brd ff:ff:ff:ff:ff:ff

root@dlp:~#
ls /etc/netplan

01-netcfg.yaml 50-cloud-init.yaml.org
# edit network settings

root@dlp:~#
vi /etc/netplan/01-netcfg.yaml
# 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
network:
  ethernets:
    enp1s0:
      dhcp4: false
      dhcp6: false
    enp7s0:
      dhcp4: false
      dhcp6: false
  bonds:
    bond0:
      addresses: [10.0.0.30/24]
      routes:
        - to: default
          via: 10.0.0.1
          metric: 100
      nameservers:
        addresses: [10.0.0.10]
        search: [srv.world]
      interfaces:
        - enp1s0
        - enp7s0
      parameters:
        mode: balance-rr
        mii-monitor-interval: 100
  version: 2

# apply changes

root@dlp:~#
netplan apply
# after setting bonding, [bonding] is loaded automatically

root@dlp:~#
lsmod | grep bond

bonding               245760  0
tls                   151552  1 bonding

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 noprefixroute
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
    link/ether 52:7d:b1:ae:a2:bc brd ff:ff:ff:ff:ff:ff permaddr 52:54:00:db:f8:fe
3: enp7s0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
    link/ether 52:7d:b1:ae:a2:bc brd ff:ff:ff:ff:ff:ff permaddr 52:54:00:c3:d9:a2
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:7d:b1:ae:a2:bc 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::507d:b1ff:feae:a2bc/64 scope link
       valid_lft forever preferred_lft forever

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