Setting up Round-Robin vs LACP (802.3ad) on Linux Systems

Introduction

in this example we are setting up an aggregate on eth0,2,3 (not eth1 that is kept for other purposes).

look for options on how to setup the module,

modinfo bonding
modinfo bonding | grep mode
modinfo bonding | grep xmit

test-run the module already w/o options - while watching the logs

tail -F /var/log/messages &
lsmod | grep bonding
modprobe bonding
rmmod bonding

LACP on Slackware Linux

ls -lF /etc/rc.d/rc.modules
ls -lF /etc/rc.d/rc.modules.local #nothing about bonding
ls -lF /etc/modprobe.conf #noexist and DEPRECATED unless forced with -C
ls -lF /etc/modprobe.d/ #nothing about bonding
vi /etc/rc.d/rc.inet1

modprobe bonding
echo 100 > /sys/class/net/bond0/bonding/miimon
echo 200 > /sys/class/net/bond0/bonding/downdelay
echo 200 > /sys/class/net/bond0/bonding/updelay
echo 4 > /sys/class/net/bond0/bonding/mode
echo 1 > /sys/class/net/bond0/bonding/lacp_rate
echo layer3+4 > /sys/class/net/bond0/bonding/xmit_hash_policy
echo +eth0 > /sys/class/net/bond0/bonding/slaves
echo +eth2 > /sys/class/net/bond0/bonding/slaves
echo +eth3 > /sys/class/net/bond0/bonding/slaves

note default xmit is 0 aka layer2

finally proceed with network setup as usual or as a bridge but against the bond0 interface instead

BONDING + XEN

echo -n cluster bridge...
brctl addbr clusterbr0
brctl addif clusterbr0 bond0
ifconfig bond0 mtu 9216 txqueuelen 9999 up
ifconfig clusterbr0 x.x.x.x/xx mtu 9216 txqueuelen 9999 up && echo done
ifconfig eth0 txqueuelen 3333 up
ifconfig eth2 txqueuelen 3333 up
ifconfig eth3 txqueuelen 3333 up

echo -n default bridge...
brctl addbr xenbr0
brctl addif xenbr0 eth1
ifconfig xenbr0 x.x.x.x/xx up && echo done
ifconfig eth1 up

RHEL/CentOS 7

setup the module,

vi /etc/modprobe.d/bonding.conf

alias bond0 bonding

set it up at boot time

systemctl stop NetworkManager
systemctl disable NetworkManager

cd /etc/sysconfig/network-scripts/
vi ifcfg-bond0

NAME=bond0
DEVICE=bond0
IPADDR=IP_ADDRESS
PREFIX=24
ONBOOT=yes

vi ifcfg-eth0

NAME=eth0
DEVICE=eth0
MASTER=bond0
SLAVE=yes
ONBOOT=yes

same for eth2,3.

tail -F /var/log/messages &
systemctl restart network

Ready to go

cat /sys/class/net/bonding_masters
cat /proc/net/bonding/bond0
cat /sys/class/net/bond0/bonding/miimon
cat /sys/class/net/bond0/bonding/downdelay
cat /sys/class/net/bond0/bonding/updelay
cat /sys/class/net/bond0/bonding/mode 
cat /sys/class/net/bond0/bonding/lacp_rate
cat /sys/class/net/bond0/bonding/xmit_hash_policy

Additional Notes

balance-rr may not be right however. Quoting NetBSD agr manual

 link0   Use the round-robin distribution algorithm.  Don't use it unless
         you're really sure, because it violates the frame ordering rule.

also note laggr did not even implement it.

Obsolete way to do things manually, for the record,

vi /etc/modprobe.d/bonding.conf 

alias bond0 bonding
options bond0 miimon=100 mode=4 lacp_rate=1

ifenslave -a
ifenslave bond0 eth0
ifenslave bond0 eth2
ifenslave bond0 eth3

References

Chapter 24. binding and bonding http://linux-training.be/sysadmin/ch24.html

Debian / Ubuntu Linux: Configure Network Bonding [ Teaming / Aggregating NIC ] https://www.cyberciti.biz/tips/debian-ubuntu-teaming-aggregating-multiple-network-connections.html

Dynamically changing the MTU of a Linux bridge interface https://joshua.hoblitt.com/rtfm/2014/05/dynamically_changing_the_mtu_of_a_linux_bridge_interface/

How to change MTU size for bonding interface ? https://access.redhat.com/solutions/64136

Setting MTU on bonded interface https://access.redhat.com/discussions/1365273

nic bonding and jumbo frames https://www.linuxquestions.org/questions/linux-networking-3/nic-bonding-and-jumbo-frames-4175581455/


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun