Ubuntu 22.04 OVH failover IP netplan config: Gateway4 deprecated
If you are using Ubuntu 22.04 with OVH failover IP, you may have encountered an issue with the netplan configuration. Specifically, the Gateway4 parameter is deprecated in this version of Ubuntu. In this article, we will explain what this means and provide you with a solution to configure your network properly.
Understanding the issue
Netplan is a utility for configuring networking on Ubuntu systems. It allows you to define network interfaces, IP addresses, gateways, and other network-related settings. In previous versions of Ubuntu, the Gateway4 parameter was used to specify the default gateway for IPv4 connections. However, starting from Ubuntu 22.04, this parameter has been deprecated.
This deprecation means that you can no longer use the Gateway4 parameter in your netplan configuration file. If you try to use it, you will encounter an error and your network configuration will not work as expected.
Solution: Using the new default gateway syntax
To configure the default gateway in Ubuntu 22.04 with OVH failover IP, you need to use the new syntax introduced in this version. The new syntax uses the "routes" keyword to define the default gateway and other routes.
Here is an example of how to configure your netplan file:
network:
version: 2
renderer: networkd
ethernets:
ens18:
dhcp4: no
addresses:
- 203.0.113.10/32
routes:
- to: 0.0.0.0/0
via: 203.0.113.254
In this example, "ens18" is the name of the network interface. Replace it with the appropriate interface name for your system. "203.0.113.10" is the IP address assigned to your failover IP. Make sure to replace it with your actual IP address.
The "routes" section is where you define the default gateway. The "to" parameter specifies the destination network, and "via" specifies the gateway IP address. In this case, "0.0.0.0/0" represents all IPv4 networks, and "203.0.113.254" is the gateway IP address provided by OVH.
Once you have updated your netplan configuration file, save it and apply the changes by running the following command:
sudo netplan apply
This command will apply the new network configuration and activate the default gateway. You should now have a working network connection with your OVH failover IP.
Conclusion
If you are using Ubuntu 22.04 with OVH failover IP, you may have encountered an issue with the netplan configuration. The Gateway4 parameter is deprecated in this version, and you need to use the new syntax to configure the default gateway. By following the steps outlined in this article, you can easily update your netplan configuration and resolve the issue.
| Reference | Link |
|---|---|
| Netplan documentation | https://netplan.io/ |
| Ubuntu documentation | https://ubuntu.com/ |
| OVH documentation | https://docs.ovh.com/ |