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.
From the netplan.io reference page here we find bond parameters that will help us:
So, in the bond0 stanza, we changed:
to:
Now when the camera goes offline, the bond0 successfully switches over to the other switch, and gets the camera back online.