OVHcloud Community

Welcome to your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Add failover IP Ubuntu 20.04


#1

Hello,

I bought a Failover IP and I don’t know how to install it, is an updated tutorial?


#2

Create a file /etc/netplan/51-failover.yaml with the following content:

network:
  version: 2
  renderer: networkd
  ethernets:
    eno0:
      addresses:
        - 1.2.3.4/32

Replace eno0 with the applicable external network interface (use “ip a” or look at the welcome screen), replace 1.2.3.4 with your failover IP, and add multiple lines if you have multiple ip addresses. Now issue “sudo netplan try”. If you somehow did mess up your server will recover in 120 seconds. If you accept the configuration, the failover IP should now be listed at “ip a”.

Multiple older tutorials didn’t actually seem to work, but this has worked successfully for us to setup a OVH failover IP on Ubuntu 20.04.


#3

Note that the above works for almost the whole internet, except for other servers in the same /24 that do not already have an entry in “arp” that is not “(incomplete)”. To fix this, something extra is needed because arp packets with the failover ip as source adress are filtered, and you cannot broadcast the failover ip with arp. Let’s say your server ip (not the failover ip) is 5.6.7.8, you need:
sudo arptables -A OUTPUT -d 5.6.7.0/24 -j mangle --mangle-ip-s 5.6.7.8

To persist this on reboot, you need some extra things. You can save the config, e.g.:
sudo arptables-save | sudo tee /etc/iptables/rules.arp
To reload it using the netfilter-persistent package if present (installed by iptables-persistent), create an executable file plugin for arp, e.g.:
echo "arptables-restore < /etc/iptables/rules.arp" | sudo tee /usr/share/netfilter-persistent/plugins.d/35-arptables
sudo chmod +x /usr/share/netfilter-persistent/plugins.d/35-arptables