If I create a connection using network bonding (using the mode active-backup), then although automatic switching to the backup network occurs if I pull out the network cable, it does not occur when the problem is no packets getting through.

What can I do to enable automatic switching to the backup network when there is packet loss on the primary with switching back when the primary is working properly (much like how network bonding with mode active-backup seamlessly switches between primary and backup and back when pulling out and plugging back in the network cable)?

  • @RuiFRibeiro I am interested in a solution that deals with failover (which need not use network bonding). – mcarans Mar 6 at 14:44
  • @RuiFRibeiro this is incorrect. Bonding manages failover, there is even a mode that does nothing but failover, active-backup. – wazoox Mar 6 at 15:22
  • If I understand your question correctly, you'd like to detect the absence of network traffic on a determined interface? This isn't in the realm of failover and bonding. You must provide more information on what you are trying to achieve. – wazoox Mar 6 at 15:25
  • @wazoox I have completed reworded it. Is it clearer now? – mcarans Mar 6 at 15:37
  • @mcarans Yes I got it :) I'm writing an answer. – wazoox Mar 6 at 15:43

By default (AFAIK), the bonding driver uses only mii monitoring to test for interface availability, i.e. carrier presence.

However you may want to use ARP monitoring, eventually for only some specific targets (for instance your main router) to test for incoming arp packets instead.

The process is described in the Linux bonding documentation.

Basically you may monitor a target (up to 16 overall) this way:

echo + > /sys/class/net/bond0/bonding/arp_ip_target

Generally you'll want to set a correct value (not too long, not too short, to be tested in operation) for the arp monitoring interval (in ms):

echo 100 > /sys/class/net/bond0/bonding/arp_interval
  • 1
    This sounds promising. So using nmcli I guess I would do: nmcli con add type bond con-name bond ifname bond0 mode active-backup primary myeth0 +bond.options "fail_over_mac=active,arp_interval=100,arp_ip_target=,primary_reselect=always,updelay=200" right? – mcarans Mar 6 at 16:10
  • @mcarans seems right, well, unless your router IP isn't of course :) – wazoox Mar 6 at 17:07
  • Thanks, I will test this for a few days to make sure it works without issue and also because the problem that causes the packet loss and required me to ask this question is intermittent. – mcarans Mar 7 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.