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.
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.
Requirements
- A dedicated server in your OVHcloud account
- A additional IP address or a additional IP block (RIPE)
- Administrative access (root) via SSH or GUI to your server
- Basic networking and administration knowledge
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 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.
Debian 10/11
Step 1: Create a backup
First, make a copy of the config file, so that you can revert at any time:
$ sudo cp /etc/network/interfaces.d/50-cloud-init /etc/network/interfaces.d/50-cloud-init.bak
Step 2: Edit the config file
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 find yours using the following command:
$ ip a
You can now modify the config file:
$ sudo vim /etc/network/interfaces.d/50-cloud-init
You then need to add a secondary interface with the following parameters:
auto eno1:1
iface eth1:1 inet static
address ADDITIONAL_IP
netmask 255.255.255.255
post-up /sbin/ifconfig eno1:! ADDITIONAL_IP netmask 255.255.255.255 broadcast ADDITIONAL_IP
pre-down /sbin/ifconfig eno1:! down
If you have two additional IPs to configure, the /etc/network/interfaces.d/50-cloud-init file should look like this:
auto eno1
iface eno1 inet dhcp
auto eno1:1
iface eno1:1 inet static
address ADDITIONAL_IP1
netmask 255.255.255.255
auto eno1:2
iface eno1:2 inet static
address ADDITIONAL_IP2
netmask 255.255.255.255
Or like this:
auto eno1
iface eno1 inet dhcp
# IPFO 1
post-up /sbin/ifconfig eno1:1 ADDITIONAL_IP1 netmask 255.255.255.255 broadcast ADDITIONAL_IP1
pre-down /sbin/ifconfig eno1:1 down
# IPFO 2
post-up /sbin/ifconfig eno1:2 ADDITIONAL_IP2 netmask 255.255.255.255 broadcast ADDITIONAL_IP2
pre-down /sbin/ifconfig eno1:2 down
Step 3: Restart the interface
You now need to restart your interface:
$ sudo systemctl restart networking
Ubuntu 17.10 and following
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.
Step 1: Determine the interface
$ ifconfig
Note the interface name and its MAC address
Step 2: Create the configuration file
Connect to your server via SSH and run the following command:
$ sudo vim /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:
$ sudo netplan try
Step 3: Apply the change
Next, run the following commands to apply the configuration:
$ sudo netplan apply
CentOS 7
Step 1: Create the config file
First, make a copy of the source file so that you can use it as a template:
$ sudo cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
Step 2: Edit the config file
Note that the name of the network interfaces in our examples may differ from your own. Please adjust to your appropriate interface names. You can find yours using the following command:
$ ip a
You can now modify the eno1:1 file in order to replace the IP:
$ sudo vi /etc/sysconfig/network-scripts/ifcfg-eno1:1
First, replace the name of the device
, then replace the existing IP with the additional IP you have received:
DEVICE="eno1:1"
ONBOOT="yes"
BOOTPROTO="none" # For CentOS use "static"
IPADDR="ADDITIONAL_IP"
NETMASK="255.255.255.255"
BROADCAST="ADDITIONAL_IP"
Step 3: Start the alias interface
You now need to start your alias interface:
$ sudo ifup eno1:1
Windows Servers
Windows servers are often DHCP-enabled in the network configuration. If you have already set up a 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.
Via a command-line interface (recommended)
In the commands below, you need to replace:
- Switch to a fixed IP
netsh interface ipv4 set address name="NETWORK_ADAPTER" static IP_ADDRESS SUBNET_MASK GATEWAY
- Set the DNS server
netsh interface ipv4 set dns name="NETWORK_ADAPTER" static 213.186.33.99
- Add a additional IP
netsh interface ipv4 add address "NETWORK_ADAPTER" IP_ADDRESS_ADDITIONAL 255.255.255.255
Your additional IP is now functional.
Via the graphical user interface
- Go to
Start
>Control Panel
>Network and Internet
>Network and Sharing Centre
>Change Adapter Settings
(in the left-hand menu). - Right-click on
Local Area Connection
. - Click on
Properties
. - Select
Internet Protocol Version 4 (TCP/IPv4)
, then click onProperties
. - Click on
Use the following IP address
and type in your server’s primary IP, subnet mask and default gateway information obtained by using theipconfig
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.
Troubleshooting
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.