I am trying to set up fail-back configuration in bonding but I am unable to get around the interface configuration. My interface is as follow:
auto bond0
iface bond0 inet static
address 192.168.1.39
netmask 255.255.255.0
up /sbin/ifenslave bond0 eth1 eth3
down /sbin/ifenslave -d bond0 eth1 eth3
My /etc/modprobe.d/bonding.conf file is:
alias bond0 bonding
options bonding mode=3
I test it by running ping from other system. My bond status is as follows:
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (broadcast)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 44:a8:42:03:68:2c
Slave queue ID: 0
Slave Interface: eth3
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 44:a8:42:03:68:2c
Slave queue ID: 0
When I remove eth1 cable the fail-over works and eth3 carries out the data (The ping still continues).
If I connect back eth1 and remove eth3 the ping stops and the bonding status doesn't contain any of the interface. The bond status is:
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (broadcast)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
I tried with all the modes in the bonding ( 0 to 6 ). But none of the configuration provides the fail-back support. Where am I going wrong?
Best Answer
EDIT 2019-01-10: These instructions are for Ubuntu 16.04 and older. I will try to update with instructions for 18.04.
In this answer, we are using
active-backup
bonding with abond-primary
interface set that allows for fail-over to go back to the primary when it is available. More information can be found: https://wiki.linuxfoundation.org/networking/bondingBonding in Ubuntu is a different setup then as in other distros of Linux like RedHat. I have done a few bonding configurations in Ubuntu and I will lay it out below as best as possible.
As it looks, you already have
ifenslave
installed, but if not, installifenslave
:Next, take a look at
/etc/modules
and make sure it has the following lines:In the
/etc/network/interfaces
file, set yourloopback
,eth1
, andeth3
interfaces:Now set your
bond0
interface withactive-backup
for fail-over if one of the NIC connections fail:Save the changes to
/etc/network/interfaces
file and restart your networking service:Now you can check your bonding setup. Make sure that your
bond0
,eth1
andeth3
are correct:Check to see if fail-over now works by removing
eth1
frombond0
:Check to see if you can still ping the gateway:
Add
eth1
back tobond0
:Hope this helps!