Network bridge with bonding on Ubuntu 16.04 Xenial
2 minute read
Well its early 2017 and it is time to upgrade servers still running Ubuntu 12.04. If these servers are virtualization hosts they most likely use a network bridge with a bonded network interface. This post describes a bonded network bridge configuration which works consistently on Ubuntu 12.04, 14.04 and 16.04 to avoid surprises of lost networking after upgrade.
So upgrade to Ubuntu 14.04 is straight forward and the bonding/bridge configuration works just the same as on 12.04. I cannot say the same for the update to 16.04.
To acually use bonding make sure you have
ifenslave installed. For normal Linux network bridges, install
bridge-utils as well.
sudo apt-get install ifenslave bridge-utils
Network configuration /etc/network/interfaces
auto lo iface lo inet loopback auto bond0 iface bond0 inet manual bond-slaves none bond-mode active-backup bond-miimon 100 bond-downdelay 200 bond-updelay 200 post-up ifup eth0 eth1 iface eth0 inet manual bond-master bond0 bond-primary eth0 iface eth1 inet manual bond-master bond0 auto br0 iface br0 inet static address 192.168.0.22 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 192.168.0.1 bridge_ports bond0 bridge_fd 0 bridge_hello 2 bridge_maxage 0 bridge_ageing 0 bridge_maxwait 0 bridge_stp off
Obviously replace the static network configuration details with your own.
The trick here is the
post-up ifup eth0 eth1 on the bond0 interface. This will join the slaves on boot after 60 seconds while the bond waits for slaves to join while at the same time having no
auto lines for the interfaces itself.
Make sure to have this configuration in place before the first reboot into Ubuntu 16.04 after update to avoid loosing network connectivity.
I publish this so it might help someone with the same issue.