現象
/etc/network/interfaces に bond_mode active-backup
と正しく記述しても
なぜかround-robin
になる問題に遭遇した。
Oct 6 06:29:01.273 JST: %SW_MATM-4-MACFLAP_NOTIF: Host xxxx.xxxx.xxxx in vlan 99 is flapping between port Ge1/0/9 and port Po1
L3SWにて上記メッセージが「約10分に1回」出力されている。
grep ^Bonding /proc/net/bonding/bond?
- kernel 4.4.44-1-pve (proxmox4) だと発生しなかった。
- kernel 4.10.17-3-pve (proxmox5:最新)で発生。
/etc/network/interfaces抜粋
auto bond0
iface bond0 inet manual
slaves eth0 eth1
bond_miimon 100
bond_mode active-backup
参考
- bonding: Sysfs Support [LWN.net]
- How to manage linux bonding without ifenslave using sysfs - Backdrift Backdrift
対応
/root/fix_bonding_mode.sh
#!/bin/sh
# round-robin に誤認識された bond0 を active-backup に修正する
grep "round-robin" /proc/net/bonding/bond0 > /dev/null
if [ $? -eq 0 ];then
/sbin/ifdown bond0
echo "active-backup" > /sys/class/net/bond0/bonding/mode
/sbin/ifup bond0
fi
crontab
@reboot sh /root/fix_bonding_mode.sh
なお /sbin/ifconfig bond0 down
だと /sys/class/net/bond0/bonding/mode
に書き込めないため ifdown
を使うこと。