Ubuntu Server 20.04 configure OVH failover IP
To configure IP in Ubuntu 20.04 guest, create file
1 |
vi /etc/netplan/50-cloud-init.yaml |
add following content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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
1 |
netplan try |
If everything works fine, you can apply the changes with
1 |
netplan apply |
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!
It works!
Thank you!
I’m using Ubuntu 20.04
OVH should have an explanation like this.