Configure additional IP on a Linux VPS
How to configure an additional IPv4 on different Linux distributions, with examples for Debian Linux and Ubuntu
Configure a secondary IP in Linux
When you order an additional IP address for your VPS, it will not be added to your server’s network settings automatically. You have to manually configure the IP address in your operating system’s network configuration or make a clean reinstall to get your IP address configured automatically (all data on your KVM will be erased during reinstall).
Below are instructions on how to add a secondary IPv4 address to your VPS. Let’s break down how to add an additional IP to the major Linux distributions:
Debian/Ubuntu:
Debian and Ubuntu use the same network configuration method.
1. Edit the Network Configuration File:
- Open the terminal.
- Edit the network interfaces file using the nano editor (or any other editor you prefer):
- Locate the entry for your network interface. It typically starts with
iface
, for instance:iface eth0 inet static
. - To add an additional IP, add the following line just below your existing configuration:
- Save the file and exit (for nano, it’s
CTRL + X
, pressY
and thenEnter
).
2. Restart the Networking Service:
CentOS:
1. Navigate to Network Scripts Directory:
2. Create a Clone File for Your Interface:
If your main interface is eth0
, the clone would be named eth0:0
.
3. Edit the Clone Configuration:
- Open the new configuration file in an editor:
- Change the
DEVICE
line to:
- Update the
IPADDR
line with your new IP address. - Make sure you remove or comment out the
UUID
line. - Save and exit.
4. Restart the Network Service:
Note: Always ensure you have permission to make these changes, and make backups of configuration files before editing them. It’s also advisable to notify any affected parties before making changes, as there might be a short downtime while you restart network services.
Was this page helpful?