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

vi /etc/network/interfaces

Add

auto NETWORK_INTERFACE_HERE
iface NETWORK_INTERFACE_HERE inet static
    address FO_IP_ADDR
    netmask 255.255.255.255
    broadcast FO_IP_ADDR
    dns-nameservers 8.8.8.8 8.8.4.4
    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

Example

Ubuntu 20.04 failover IP

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.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *