IP aliasing is a special network configuration for your OVHcloud servers which allows you to associate multiple IP addresses with a single network interface. In this article, we will walk through how to configure IP aliasing on your VPS.
- A failover IP address (/32 block only)
- Root access to the server
Step 1: Disable Automatic Network Configuration
First, create the following file in a text editor of your choice:
$ sudo vi /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
Next, enter the following text into the new file. This will prevent Debian from making automatic network configuration changes.
Save the file and exit the editor when you have confirmed the changes are correct.
Step 2: Edit the Network Configuration File
Next, open the network configuration file for editing with the following command:
$ sudo vi /etc/network/interfaces.d/50-cloud-init.cfg
Then edit the file with the following configuration, replacing the name of the network interface and failover IPs in red with the NIC name and failover IP address on your VPS:
iface eth0 inet dhcp
iface eth0:0 inet static
iface eth0:1 inet static
Finally, bring up the new interface you have created using the following command:
$ sudo ifup eth0:0
To configure IP aliasing in Ubuntu 20.04, SSH into your server and open the interface configuration file in Netplan using the following command:
$ sudo vi /etc/netplan/50-cloud-init.yaml
In this file, one interface will already be configured: the default interface for your VPS. Add a second interface with the same name as the first one and use your failover IP instead of the IP for the VPS. The file will appear as follows:
Note: The items in red in the above file will be unique to your machine so change them accordingly.
Now apply the new file using the following command:
$ sudo netplan apply
Before adding our failover IP to the interface, we will first determine our active interface by using the following command.
The interface with the VPS's IP address attached will be the active interface. In our example, we will use
eth0. To configure the failover IP as an alias, run the following command replacing the interface name and IP address in red with the correct ones for your VPS:
$ sudo ifconfig eth0:0 203.0.113.1 netmask 255.255.255.255 up
This command configures the alias and also brings it up so, once you have confirmed that the IP address pings, you are done. Next, we will take a look at how to configure IP aliasing in Windows Server 2019.
Windows Server 2019
By default, Windows Server will have DHCP enabled in the network configuration. If you have already set up a failover IP or switched your configuration to a fixed IP, go directly to the next step.
Otherwise, you need to first switch from a network-level DHCP configuration to a fixed IP configuration.
Open the command prompt by typing
cmd in the search bar. Then type the following command.
Identify and write down your IPv4 address, subnet mask, default gateway, and the name of the network adapter.
Once you have these pieces of information, proceed to the next step. We will cover how to perform these steps in
cmd as this is the easier method. We will use the following three commands to configure the failover IP.
Step One - Switch to a static IP
netsh interface ipv4 set address name="NETWORK_ADAPTER" static IP_ADDRESS SUBNET_MASK GATEWAY
Step Two - Set the DNS server
netsh interface ipv4 set dns name="NETWORK_ADAPTER" static 220.127.116.11
Step Three - Add the Failover IP
netsh interface ipv4 add address "Ethernet" FAILOVER_IP 255.255.255.255
Ping the failover IP to ensure the changes have worked.
Now that you have read this article, you should be able to configure IP aliasing on Debian 10, Ubuntu 20.04, CentOS 8, and Windows Server 2019.