Configure OVH Failover IP in Ubuntu 20.04/22.04

To configure IP in Ubuntu Server 20.04 guest, create a file

vi /etc/netplan/50-netwrk.yaml

add the following content

network:
    version: 2
    ethernets:
        eth0:
            addresses:
                - YOUR_FO_IP_HERE/32
            nameservers:
                addresses:
                    - 1.1.1.1
                search: []
            optional: true
            routes:
                - to: 0.0.0.0/0
                  via: YOUR_GW_IP_HERE
                  on-link: true

example

root@easyengine:~# cat /etc/netplan/50-cloud-init.yaml
network:
    version: 2
    ethernets:
        eth0:
            addresses:
                - 164.132.150.95/32
            nameservers:
                addresses:
                    - 1.1.1.1
                search: []
            optional: true
            routes:
                - to: 0.0.0.0/0
                  via: 51.255.79.254
                  on-link: true
root@easyengine:~# 

“on-link: true” is what makes it work. The “on-link: true” option is used to specify that a specific route should be considered “on-link.” This means that the route is directly reachable on the local network segment, and packets destined for that route should be sent directly to the network interface associated with that network segment, rather than being routed through a gateway.

Test network config using

netplan try

If everything works fine, you can apply the changes with

netplan apply

See OVH, netplan

Need help with Linux Server or WordPress? We can help!

2 Comments

  • Can confirm: this works like a charm on a fresh Ubuntu Server 20.04 install. I’m using Proxmox 7.0-10 on an OVH dedicated server.

    Thank you good sir!

Leave a Reply

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