Configure IP Aliasing on a Dedicated Server

View as Markdown

Add and configure Additional IP addresses on your OVHcloud dedicated server for multi-site or service hosting.

Info

This article is about Additional IPv4 configuration on a public interface. You can also configure Primary IPv6 addresses on your dedicated servers using this guide.

Please note that Additional IP addresses can also be configured in a vRack (private network), which allows interconnection over a wide range of OVHcloud services, offering more flexibility.

Learn how to configure Additional IP addresses in a vRack with our guides for IPv4 and IPv6.

Objective

IP aliasing is a special network configuration for your OVHcloud dedicated servers, which allows you to associate multiple IP addresses with a single network interface.

This guide explains how to add Additional IP addresses to your network configuration.

Warning

OVHcloud is providing you with services for which you are responsible, with regard to their configuration and management. You are therefore responsible for ensuring they function correctly.

This guide is designed to assist you in common tasks as much as possible. Nevertheless, we recommend that you contact a specialist service provider if you have difficulties or doubts concerning the administration, usage or implementation of services on a server.

Requirements

  • A dedicated server in your OVHcloud account
  • An Additional IP address or an Additional IP block (RIPE or ARIN)
  • Access via SSH or remote desktop connection for Windows
  • Basic networking and administration knowledge
Warning

This feature might be unavailable or limited on servers of the Eco product line.

Please visit our comparison page for more information.

Instructions

The following sections contain configurations for the distributions we currently offer and the most commonly used distributions/operating systems. The first step is always to log in to your server via SSH or a GUI login session (RDP for a Windows server).

Info

Concerning different distribution releases, the procedure for configuring your network interface and file names may have changed. We recommend consulting the manuals and knowledge resources of the respective OS versions if you experience any issues.

Please take note of the following terminology that will be used in code examples and instructions of the guide sections below:

TermDescriptionExamples
ADDITIONAL_IPAn Additional IP address assigned to your service203.0.113.1
NETWORK_INTERFACEThe name of the network interfaceeth0, ens3
IDID of the IP alias, starting with 0 (depending on the number of additional IPs there are to configure)0, 1

In the examples below, we will use the nano text editor. With some operating systems, you will need to install it first. If this is the case, you will be prompted to do so. You can, of course, use the text editor of your choice.

Tip

Select the tab corresponding to your operating system.

Debian 11
Fedora 42+ / AlmaLinux (10) / Rocky Linux (10)
Debian 12+ and Ubuntu 20.04+
AlmaLinux / Rocky Linux
cPanel
Windows Servers
Plesk

Debian 11

By default, the configuration files are located in /etc/network/interfaces.d/. We recommend that you start by backing up the relevant configuration file.

Step 1: Create a backup

In our example, our file is called 50-cloud-init, so we make a copy of the 50-cloud-init file using the following command:

sudo cp /etc/network/interfaces.d/50-cloud-init /etc/network/interfaces.d/50-cloud-init.bak

In case of a mistake, you will be able to revert the changes, using the commands below:

sudo rm -f /etc/network/interfaces.d/50-cloud-init
sudo cp /etc/network/interfaces.d/50-cloud-init.bak /etc/network/interfaces.d/50-cloud-init

Step 2: Edit the configuration file

Info

Note that the names of the network interfaces in our examples may differ from your own. Please adjust to your appropriate interface names.

You can now modify the configuration file:

sudo nano /etc/network/interfaces.d/50-cloud-init

Next, you need to add a virtual interface or ethernet alias. In our example, our interface is called eth0, so our alias is eth0:0. Do this for each additional IP you wish to configure.

Do not modify the existing lines in the configuration file, simply add your Additional IP to the file as follows, replacing ADDITIONAL_IP/32 as well as the virtual interface (if your server is not using eth0:0) with your own values:

auto eth0:0
iface eth0:0 inet static
address ADDITIONAL_IP
netmask 255.255.255.255

Alternatively, you can configure your Additional IP by adding the following lines in the configuration file:

post-up /sbin/ifconfig eth0:0 ADDITIONAL_IP netmask 255.255.255.255 broadcast ADDITIONAL_IP
pre-down /sbin/ifconfig eth0:0 down

With the configuration above, the virtual interface is enabled or disabled whenever the eth0 interface is enabled or disabled.

If you have two Additional IPs to configure, the /etc/network/interfaces.d/50-cloud-init file should look like this:

auto eth0
iface eth0 inet dhcp

auto eth0:0
iface eth0:0 inet static
address ADDITIONAL_IP1
netmask 255.255.255.255

auto eth0:1
iface eth0:1 inet static
address ADDITIONAL_IP2
netmask 255.255.255.255

Or like this:

auto eth0
iface eth0 inet dhcp

# IP 1
post-up /sbin/ifconfig eth0:0 ADDITIONAL_IP1 netmask 255.255.255.255 broadcast ADDITIONAL_IP1
pre-down /sbin/ifconfig eth0:0 down

# IP 2
post-up /sbin/ifconfig eth0:1 ADDITIONAL_IP2 netmask 255.255.255.255 broadcast ADDITIONAL_IP2
pre-down /sbin/ifconfig eth0:1 down
Configuration example
 auto eth0
 iface eth0 inet dhcp

auto eth0:0
 iface eth0:0 inet static
 address 203.0.113.1
netmask 255.255.255.255

Or:

auto eth0
iface eth0 inet dhcp

# IP 1
post-up /sbin/ifconfig eth0:0 203.0.113.1 netmask 255.255.255.255 broadcast 203.0.113.1
pre-down /sbin/ifconfig eth0:0 down

Step 3: Restart the interface

To restart the interface, use the following command:

sudo /etc/init.d/networking restart

Troubleshooting

If restarting the interface does not work, reboot your server from the command line or its GUI. If you are still unable to establish a connection from the public network to your Additional IP and suspect a network problem, you need to reboot the server in rescue mode. Then you can set up the Additional IP address directly on the server.

Once you are connected to your server via SSH, enter the following command:

ifconfig eth0:0 ADDITIONAL_IP netmask 255.255.255.255 broadcast ADDITIONAL_IP up

To test the connection, ping your Additional IP from outside. If it responds in rescue mode, this indicates a configuration error. If, however, the IP is still not working, please open a ticket with the support team via the OVHcloud Help Center with the following information:

  • The operating system name and version you are using on your server.
  • The name and directory of the network configuration file.
  • The content of that file.

Go further

Configuring a network bridge

Moving an Additional IP on a Dedicated Server

Join our community of users.

Was this page helpful?