Configure Failover IP in Ubuntu 20.04 OVH VPS
To configure IP on OVH VPS, you need to manually configure networking as OVH gateway is outside the failover IP subnet. For most hosting providers getaway will be in the same subnet as the IP address. To configure IP using netplan, see instruction here.
First, install ifupdown package
apt install -y ifupdown
Now edit file
iface NETWORK_INTERFACE_HERE inet static
dns-nameservers 18.104.22.168 22.214.171.124
post-up ip route add GATEWAY_ADDR dev NETWORK_INTERFACE_HERE
post-up ip route add default via GATEWAY_ADDR dev NETWORK_INTERFACE_HERE
pre-down ip route del GATEWAY_ADDR dev NETWORK_INTERFACE_HERE
pre-down ip route del default via GATEWAY_ADDR dev NETWORK_INTERFACE_HERE
In the above text, replace
NETWORK_INTERFACE_HERE = with your actual network interface name, for example, eth0, ens18, etc.
FO_IP_ADDR = Your VPS IP address, OVH calls this Failover IP address. It is just any secondary IP address you purchase.
GATEWAY_ADDR = Gateway IP address. This is the same as the Main IP of the server with the last octal replaced by 254
Configuration is the same as Ubuntu 18.04, the only difference is post-up and pre-down tines, where Ubuntu 18.04 used older route command, in Ubuntu 20.04, we use “ip route” command instead.