Bond Interface

References:
https://www.kernel.org/doc/Documentation/networking/bonding.txt
https://www.kernel.org/doc/Documentation/networking/multiqueue.txt

Check default settings with:
$ modinfo bonding

Load bonding module:
$ modprobe --first-time bonding
$ lsmod | grep bond


Set up bond interface:
$ cat /etc/sysconfig/network-scripts/ifcfg-bond0
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=no
PEERDNS=no
PEERROUTES=no
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_PEERDNS=no
IPV6_PEERROUTES=no
IPV6_FAILURE_FATAL=no
NAME=bond0
DEVICE=bond0
ONBOOT=yes
NM_CONTROLLED=no


Set up slave interfaces:
$ cat /etc/sysconfig/network-scripts/ifcfg-ens2f0
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=no
PEERDNS=no
PEERROUTES=no
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_PEERDNS=no
IPV6_PEERROUTES=no
IPV6_FAILURE_FATAL=no
NAME=ens2f0
DEVICE=ens2f0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
NM_CONTROLLED=no

$ cat /etc/sysconfig/network-scripts/ifcfg-ens2f1
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=no
PEERDNS=no
PEERROUTES=no
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_PEERDNS=no
IPV6_PEERROUTES=no
IPV6_FAILURE_FATAL=no
NAME=ens2f1
DEVICE=ens2f1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
NM_CONTROLLED=no


$ sudo modprobe bonding tx_queues=16 mode=0
$ sudo ifup bond0

See list of bond master devices:
$ cat /sys/class/net/bonding_masters

Check bond status of bond0 with:
$ cat /proc/net/bonding/bond0

Allocate TX queues for bond slaves:
$ cat /sys/class/net/bond0/bonding/queue_id
Change queues with:
$ sudo bash -c 'echo "ens2f1:1" > /sys/class/net/bond0/bonding/queue_id'

Statistics:
cat /sys/class/net/bond0/statistics/*

In bond mode 0 (balance-rr):
$ cat /sys/class/net/bond0/bonding/mode
balance-rr 0

All slave devices are active so "none" are shown:
$ cat /sys/class/net/bond0/bonding/slaves
ens2f0 ens2f1
$ cat /sys/class/net/bond0/bonding/active_slave

Previous page: 'ufw' - Notes
Next page: Interface and bridge notes