1

I have tried to set up bonding between two switches that link to one switch that is linked to a camera (10.0.10.10):

Camera
  |
  |
Switch 1 - - - - - - - - 
  |                    |
  | A                  | B
  |                    |
Switch Primary      Switch Secondary
  |                    |
C | enp3s4f0         D | enp3s4f1 
  |                    |
  |                    |
 ---------------------------
 |Ubuntu 18.04             |
 |       bond0             |
 |------------------------ |

The goal is to be able to ping the camera if any of connections A/B/C/D die. Currently, if connection A dies, the camera cannot be pinged. If any other connection fails, it can still ping the camera.

This is my 01-netcfg.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s4f0:
      addresses: [ ]
    enp3s4f1:
      addresses: [ ]
    bonds:
      bond0:
        addresses: [ 10.0.10.101/24 ]
        gateway4: 10.0.10.10
        nameservers:
          addresses: [ 1.1.1.1, 1.1.1.0 ]
        interfaces: [ enp3s4f0, enp3s4f1 ]
        parameters:
          mode: active-backup
          primary: enp3s4f0

After applying the netplan, no errors are thrown:

sudo netplan apply

The problem is that when A is disconnected, the server still recognizes connection C as active so the bond does not change its interface and therefore it keeps trying to reach the camera from Primary Switch, which isn’t possible.

  • There must be a problem between enp3s4f1 and the camera. How is the camera connected to the two switches? Do you have 1 switch, or 3 switches? – heynnema Jun 6 at 15:49
  • @heynnema There are 3 switches in total. The camera is connected to Switch 1 which is connected to two other switches (enp3s4f1, enp3s4f0), and those are connected to the server. I can ping the camera from enp3s4f0 and enp3s4f1 independently. But the bonding is not working. Whenever the primary interface in the bond is disconnected, the camera can no longer be pinged. – udpcon Jun 6 at 16:07
  • This is a server, yes? Edit your question and show me sudo lshw -C network with everything connected, and show it again with enp3s4f0 disconnected at the server. – heynnema Jun 6 at 16:15
  • @heynnema Done. Yes it is a server. – udpcon Jun 6 at 16:42
  • Are these gigabit switches? You didn't disconnect both ethernet cables, correct? – heynnema Jun 6 at 18:33
0

From the netplan.io reference page here we find bond parameters that will help us:

arp-interval (scalar)
    Set the interval value for how frequently ARP link monitoring should 
    happen. The default value is 0, which disables ARP monitoring. For the
    networkd backend, this maps to the ARPIntervalSec= property. If no time
    suffix is specified, the value will be interpreted as milliseconds.

arp-ip-targets (sequence of scalars) IPs of other hosts on the link which
    should be sent ARP requests in order to validate that a slave is up. 
    This option is only used when arp-interval is set to a value other than 0.
    At least one IP address must be given for ARP link monitoring to function.
    Only IPv4 addresses are supported. You can specify up to 16 IP addresses.
    The default value is an empty list.

So, in the bond0 stanza, we changed:

parameters:
  mode: active-backup
  primary: enp3s4f0

to:

parameters:
  mode: active-backup
  primary: enp3s4f0
  arp-interval: 10
  arp-ip-targets: 10.0.10.10

Now when the camera goes offline, the bond0 successfully switches over to the other switch, and gets the camera back online.

  • You cannot use mii-monitor-interval and arp-interval at the same time. Error when doing netplan apply. Forgot to mention that. – udpcon Jun 7 at 22:36
  • @udpcon What about the IP problem with the camera and gateway4? – heynnema Jun 7 at 22:41
  • I believe I have tried that but it was not relevant. Can confirm when I am near the workspace. – udpcon Jun 7 at 22:45
  • @udpcon no, the problem is that you've listed the camera IP and the gateway4 IP as 10.0.10.10. They BOTH can't be the same IP. When you find the correct IP's, edit your question, let me know the correct IP's, I'll do a final edit on my answer, then you can accept it if you found it all helpful :-) – heynnema Jun 7 at 22:56
  • They actually are the same IP :) Would that directly affect the current issue? – udpcon Jun 7 at 22:57

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.