Configuring IP aliasing
Find out how to add Additional IP addresses to your server configuration
Find out how to add Additional IP addresses to your server configuration
Last updated 15th February 2023
Since October 6th, 2022 our service "Failover IP" is named Additional IP. This renaming has no effect on its technical features.
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.
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.
This feature might be unavailable or limited on servers of the Eco product line.
Please visit our comparison page for more information.
The following sections contain the configurations for the most commonly used distributions/operating systems.
Concerning different distribution releases, please note that the proper procedure to configure your network interface as well as the file names may have been subject to change. We recommend to consult the manuals and knowledge resources of the respective OS versions if you experience any issues.
First, make a copy of the config file, so that you can revert at any time:
cp /etc/network/interfaces.d/50-cloud-init /etc/network/interfaces.d/50-cloud-init.bak
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 config file:
editor /etc/network/interfaces.d/50-cloud-init
You then need to add a secondary interface:
auto eth0:0
iface eth0:0 inet static
address ADDITIONAL_IP
netmask 255.255.255.255
To ensure that the secondary interface is enabled or disabled whenever the eth0
interface is enabled or disabled, you need to add the following line to the eth0 configuration:
post-up /sbin/ifconfig eth0:0 ADDITIONAL_IP netmask 255.255.255.255 broadcast ADDITIONAL_IP
pre-down /sbin/ifconfig eth0:0 down
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
You now need to restart your interface:
/etc/init.d/networking restart
First, make a copy of the config file, so that you can revert at any time:
cp /etc/network/interfaces /etc/network/interfaces.bak
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 config file:
editor /etc/network/interfaces
You then need to add a secondary interface:
auto eth0:0
iface eth0:0 inet static
address ADDITIONAL_IP
netmask 255.255.255.255
To ensure that the secondary interface is enabled or disabled whenever the eth0
interface is enabled or disabled, you need to add the following line to the eth0 configuration:
post-up /sbin/ifconfig eth0:0 ADDITIONAL_IP netmask 255.255.255.255 broadcast ADDITIONAL_IP
pre-down /sbin/ifconfig eth0:0 down
If you have two Additional IPs to configure, the /etc/network/interfaces file should look like this:
auto eth0
iface eth0 inet static
address SERVER_IP
netmask 255.255.255.0
broadcast xxx.xxx.xxx.255
gateway xxx.xxx.xxx.254
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 static
address SERVER_IP
netmask 255.255.255.0
broadcast xxx.xxx.xxx.255
gateway xxx.xxx.xxx.254
# 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
You now need to restart your interface:
/etc/init.d/networking restart
On these distributions, the naming of interfaces as eth0, eth1 (and so on) is abolished. We will therefore use systemd-network
more generally.
First, make a copy of the config file, so that you can revert at any time:
cp /etc/systemd/network/50-default.network /etc/systemd/network/50-default.network.bak
You can now add your Additional IP to the config file, as follows:
editor /etc/systemd/network/50-default.network
[Address]
Address=ADDITIONAL_IP/32
Label=failover1 # optional
The label is optional. It’s just for distinguishing between your various Additional IPs.
You now need to restart your interface:
systemctl restart systemd-networkd
Fedora now uses keyfiles. NetworkManager previously stored network profiles in ifcfg format in this directory: /etc/sysconfig/network-scripts/
. However, the ifcfg format is now deprecated. By default, NetworkManager no longer creates new profiles in this format. The configuration file is now found in /etc/NetworkManager/system-connections/
.
First, make a copy of the config file, so that you can revert at any time:
cp -r /etc/NetworkManager/system-connections/cloud-init-eno1.nmconnection /etc/NetworkManager/system-connections/cloud-init-eno1.nmconnection.bak
Note that the name of the network file in our example may differ from your own. Please adjust to your appropriate name. To obtain the name of your network interface so you can edit the proper network file, you can run the following command: ip a
.
You can also verify the connected interface with the following command:
nmcli connection show
You can now add your Additional IP to the config file, as follows:
editor /etc/NetworkManager/system-connections/cloud-init-eno1.nmconnection
[ipv4]
method=auto
may-fail=false
address1=ADDITIONAL_IP/32
If you have two Additional IPs to configure, the configuration file should look like this:
[connection]
id=cloud-init eno1
uuid=xxxxxxx-xxxx-xxxe-ba9c-6f62d69da711
type=ethernet
[user]
org.freedesktop.NetworkManager.origin=cloud-init
[ethernet]
mac-address=MA:CA:DD:RE:SS:XX
[ipv4]
method=auto
may-fail=false
address1=ADDITIONAL_IP1/32
address2=ADDITIONAL_IP2/32
You now need to restart your interface:
systemctl restart NetworkManager
Each Additional IP address will need its own line in the configuration file. The configuration file is called "50-cloud-init.yaml" and is located in /etc/netplan.
ifconfig
Note the interface name and its MAC address
Connect to your server via SSH and run the following command:
editor /etc/netplan/50-cloud-init.yaml
Next, edit the file with the content below, replacing INTERFACE_NAME
MAC_ADDRESS
and ADDITIONAL_IP
:
network:
version: 2
ethernets:
INTERFACE_NAME:
dhcp4: true
match:
macaddress: MAC_ADDRESS
set-name: INTERFACE_NAME
addresses:
- ADDITIONAL_IP/32
Save and close the file. You can test the configuration with the following command:
netplan try
Next, run the following commands to apply the configuration:
netplan apply
First, make a copy of the source file so that you can use it as a template:
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
You can now modify the eth0:0 file in order to replace the IP:
editor /etc/sysconfig/network-scripts/ifcfg-eth0:0
First, replace the name of the device
, then replace the existing IP with the Additional IP you have received:
DEVICE="eth0:0"
ONBOOT="yes"
BOOTPROTO="none" # For CentOS use "static"
IPADDR="ADDITIONAL_IP"
NETMASK="255.255.255.255"
BROADCAST="ADDITIONAL_IP"
You now need to start your alias interface:
ifup eth0:0
You need to restart your interface:
systemctl restart NetworkManager
First, make a copy of the config file, so that you can revert at any time:
cp /etc/conf.d/net /etc/conf.d/net.bak
Now you have to edit the file to add the Additional IP. In Gentoo, an alias is added directly in the eth0 interface. You do not need to create an eth0:0 interface like in other distributions.
The server’s default IP and config_eth0= should stay on the same line. This is to ensure that certain OVHcloud-specific operations work properly.
All you need to do is add a line break after the netmask 255.255.255.0 and add your Additional IP (SERVER_IP must be replaced by your server’s primary IP).
editor /etc/conf.d/net
You therefore need to add the following:
config_eth0=( "SERVER_IP netmask 255.255.255.0" "ADDITIONAL_IP netmask 255.255.255.255 brd ADDITIONAL_IP" )
The /etc/conf.d/net
file must contain the following:
#This blank configuration will automatically use DHCP for any net.
# scripts in /etc/init.d. To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
config_eth0=( "SERVER_IP netmask 255.255.255.0"
"ADDITIONAL_IP netmask 255.255.255.255 brd ADDITIONAL_IP" )
routes_eth0=( "default gw SERVER_IP.254" )
In order to ping your Additional IP, simply restart the network interface.
You now need to restart your interface:
/etc/init.d/net.eth0 restart
First, make a copy of the config file, so that you can revert at any time:
cp /etc/sysconfig/network/ifcfg-ens32 /etc/sysconfig/network/ifcfg-ens32.bak
Open the file:
editor /etc/sysconfig/network/ifcfg-ens32
Then add the following:
IPADDR_1=ADDITIONAL_IP
NETMASK_1=255.255.255.255
LABEL_1=ens32:0
Finally, reboot your server to apply the changes.
In the WHM control panel, click on IP Functions
and select Add a New IP Address
in the left-hand sidebar.
Enter your Additional IP in the form xxx.xxx.xxx.xxx
into the field “New IP or IP range to add”.
Select 255.255.255.255
as your subnet mask, then click on Submit
.
Please note that if you have more than one IP to configure on the same block and you add them all at once, the WHM system will force you to use the subnet mask 255.255.255.0
. We do not recommend using this configuration. Instead, you need to add each IP individually in order to use the proper subnet mask 255.255.255.255
.
Back in the section IP Functions
, click on Show or Delete Current IP Addresses
to verify that the Additional IP address was added correctly.
Windows servers are often DHCP-enabled in the network configuration. If you have already set up an Additional 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 cmd
or powershell
, then type the following command:
ipconfig /all
This will return a result similar to the following example:
Identify and write down your IPv4, subnet mask, default gateway and the name of the network interface controller (network adapter).
In our example, the server IP is 94.23.229.151.
You can perform the next steps via either a command-line interface or the graphical user interface.
In the commands below, you need to replace:
Command | Value |
---|---|
NETWORK_ADAPTER | Name of the network adapter (in our example: Local Area Connection) |
IP_ADDRESS | Server IP address (in our example: 94.23.229.151) |
SUBNET_MASK | Subnet mask (in our example: 255.255.255.0) |
GATEWAY | Default gateway (in our example: 94.23.229.254) |
ADDITIONAL_IP | Address of Additional IP you want to add |
Be careful – the server will no longer be accessible if you enter incorrect information. You will then have to make the corrections in Winrescue mode or via the KVM.
In the command prompt:
netsh interface ipv4 set address name="NETWORK_ADAPTER" static IP_ADDRESS SUBNET_MASK GATEWAY
netsh interface ipv4 set dns name="NETWORK_ADAPTER" static 213.186.33.99
netsh interface ipv4 add address "NETWORK_ADAPTER" ADDITIONAL_IP 255.255.255.255
Your Additional IP is now functional.
Start
> Control Panel
>Network and Internet
> Network and Sharing Centre
> Change Adapter Settings
(in the left-hand menu).Local Area Connection
.Properties
.Internet Protocol Version 4 (TCP/IPv4)
, then click on Properties
.Use the following IP address
and type in your server’s primary IP, subnet mask and default gateway information obtained by using the ipconfig
command above. In the "Preferred DNS Server" box, type 213.186.33.99.Be careful – the server will no longer be accessible if you enter incorrect information. You will then have to make the corrections in Winrescue mode or via the KVM.
Then click on Advanced
(still in the TCP/IP Settings
).
In the IP Address
section, click Add
:
Type in your Additional IP and the subnet mask 255.255.255.255.
Click on Add
.
Your Additional IP is now functional.
In the Plesk control panel, choose Tools & Settings
from the left-hand sidebar.
Click on IP Addresses
under Tools & Resources.
In this section, click on the button Add IP Address
.
Enter your Additional IP in the form xxx.xxx.xxx.xxx/32
into the field "IP address and subnet mask", then click on OK
.
Back in the section "IP Addresses", verify that the Additional IP address was added correctly.
Determine the name of your primary network interface. You can use the ifconfig
command for this operation:
ifconfig
This will return the following:
ifconfig
>>> nfe0: flags=8843 metric 0 mtu 1500
>>> options=10b
>>> ether 00:24:8c:d7:ba:11
>>> inet 94.23.196.18 netmask 0xffffff00 broadcast 94.23.196.255
>>> inet 87.98.129.74 netmask 0xffffffff broadcast 87.98.129.74
>>> media: Ethernet autoselect (100baseTX )
>>> status: active
>>> lo0: flags=8049 metric 0 mtu 16384
>>> options=3
>>> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
>>> inet6 ::1 prefixlen 128
>>> inet 127.0.0.1 netmask 0xff000000 v comsdvt#
In our example, the name of the interface is therefore nfe0.
Next, make a copy of the config file, so that you can revert at any time:
cp /etc/rc.conf /etc/rc.conf.bak
Edit the /etc/rc.conf file:
editor /etc/rc.conf
Then add this line at the end of the file: ifconfig_INTERFACE_alias0="inet ADDITIONAL_IP netmask 255.255.255.255 broadcast ADDITIONAL_IP"
.
Replace INTERFACE and ADDITIONAL_IP with the name of your interface (identified in the first step) and your Additional IP, respectively. Here is an example:
ifconfig_nfe0_alias0="inet 87.98.129.74 netmask 255.255.255.255 broadcast 87.98.129.74"
You now need to restart your interface:
/etc/rc.d/netif restart && /etc/rc.d/routing restart
Determine the name of your primary network interface. You can use the ifconfig
command for this operation:
ifconfig -a
This will return the following:
ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
e1000g0: flags=1000843 mtu 1500 index 2
inet 94.23.41.167 netmask ffffff00 broadcast 94.23.41.255
ether 0:1c:c0:f2:be:42
In our example, the name of the interface is therefore e1000g0.
editor /etc/hostname.e1000g0:1
In this file, enter the following: ADDITIONAL_IP/32 up, where ADDITIONAL_IP is your Additional IP. For example:
188.165.171.40/32 up
You now need to restart your interface:
svcadm restart svc:/network/physical:default
First, restart your server from the command line or its GUI. If you are still unable to establish a connection from the public network to your alias 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, simply ping your Additional IP from the outside. If it responds in rescue mode, that probably means that there is a configuration error. If, however, the IP is still not working, please inform our support teams by creating a support request in your OVHcloud Control Panel for further investigations.
Activating and using rescue mode
Join our community of users on https://community.ovh.com/en/.
Please feel free to give any suggestions in order to improve this documentation.
Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.
Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.
Thank you. Your feedback has been received.
Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.
Discuss with the OVHcloud community