Bonding
Welcome to the new interface bonding guide. This may be of special interest for Realtek switch users. Feel free to add your knowledge here.
Terminology
- Bond
- LAG (Link Aggregation Group)
- Trunk
- Team (Linux kernel driver + userspace teamd daemon)
Configuration
This guide targets kernel 6.18 and the latest snapshot targets, specifically the Realtek switch targets.
When bonding ports, the ports should be removed from and the new bond device used in:
- their parent bridge
- VLAN tagging
Example configuration:
config device 'switch'
option name 'switch'
option type 'bridge'
option macaddr 'A:B:C:D:E:F'
list ports 'lan1'
list ports 'lan2'
list ports 'lan3'
list ports 'lan4'
list ports 'lan5'
list ports 'lan6'
# list ports 'lan7'
# list ports 'lan8'
list ports 'bond-0'
config bridge-vlan 'lan_vlan'
option device 'switch'
option vlan '1'
list ports 'lan1:u*'
list ports 'lan2:u*'
list ports 'lan3:u*'
list ports 'lan4:u*'
list ports 'lan5:u*'
list ports 'lan6:u*'
# list ports 'lan7:u*'
# list ports 'lan8:u*'
list ports 'bond-0:u*'
config device
option name 'switch.1'
option macaddr 'A:B:C:D:E:F'
config interface '0'
option proto 'bonding'
option bonding_policy '802.3ad'
list slaves 'lan7'
list slaves 'lan8'
option xmit_hash_policy 'layer3+4'
option lacp_rate 'fast' # LACPDUs
option monitor_interval '100' #miimon
- lan7 & lan8 are removed from the bridge
switch - lan7 & lan8 are removed from the VLAN
lan-vlan - A bond named
0and given the device namebond-0is created - bond-0 is added to the bridge
switch - bond-0 is added to the VLAN
lan-vlan - bond-0 settings are applied:
protomust bebondingbonding-policyshould generally be802.3adwhere hardware offload is desiredxmit-hash-policyappears to work best withlayer3+4- calculates link index by hashing header IP address and port values
- allows
802.3adto be selected, other values may fallback toround-robin
lacp_rateset tofast, sends LACP packets every second, therefore detects failover after at most 1 second. Default is to send every 30 seconds.monitor_intervalset to100monitors link status every 100ms to detect link state changes.
- If you are running MLAG/VPC then you may also wish to update the `ad_select` policy:
ad_selectset tobandwidthchooses aggregators to prioritise throughput, reselects aggregator when:- A port is added to or removed from the bond;
- Any port's link state changes;
- Any port's 802.3ad association state changes;
- The bond's administrative state changes to up.
ad_selectset tostable(default) only changes links when the active ports are down or not available.
Settings should be identical at both ends of the bonds (except the lan port selection which can vary at each end).