Adding IP Addresses to Your Linux Server (Loopback)
WARNING: We have multiple configuration methods for our servers' networking. To make sure you use the correct procedure when configuring additional IPs on your server, please see Adding IP Addresses to Your Dedicated Server.
Some of the information in this article is advanced material we make available as a courtesy. Please be advised that you are responsible for properly following the procedures below. Customer Support cannot assist with these topics.
When you receive additional IPs for your server, you have to configure your server to accept requests from them. The process to add IP addresses to your server depends on your operating system.
NOTE: We configure all of your server's IP addresses automatically whenever you reprovision your server. However, reprovisioning erases all content from your server's hard drives. For more information, see Is there a way for me to start over with my dedicated server?
We automatically configure additional IP addresses for Virtual Private Servers (VPS).
CentOS/Fedora
- Access your server via SSH.
- Run
su -
to switch to the root user. - Run the following command to switch to the folder where the network configuration scripts are located:
cd /etc/sysconfig/network-scripts
- Run the following command to view the current network adapters:
ls ifcfg*Your server's primary IP displays as
ifcfg-eth0
andifcfg-lo
; additional IPs display asifcfg-lo:0
,ifcfg-lo:1
, etc. - Run the following command to add an entry for your new IP address:
cp ifcfg-eth0 ifcfg-lo:[X]Where
[X]
is 2 less than the number of IPs the server will have after adding the new IP. For example, to add the server's third IP address, use 1 as the value of[X]
. - Using a text editor, edit
ifcfg-lo:[X]
by changing the following values:- IPADDR — Change to the new IP address.
- DEVICE — Change to lo:[X], where [X] is the same [X] value from the previous steps.
- NETMASK — Change to 255.255.255.255.
- Remove the entire line beginning with ETHTOOL_OPTS.
- Run the following command to bring the new IP online:
/sbin/ifup ifcfg-lo:[X]Where [X] is the same [X] value from the previous steps.
Ubuntu
- Access your server via SSH.
- Run
su -
to switch to the root user. - Run the following command to switch to the folder where the network configuration scripts are located:
cd /etc/network/
- In a text editor, open the file
interfaces
. Your server's primary IP displays aseth0
; additional IPs display aslo:0
,lo:1
, etc. - Add the following to the bottom of this file, save it, and then exit the editor:
auto lo:[X]
iface lo:[X] inet static
address [ip address]
netmask 255.255.255.255[X]
is 2 less than the number of IPs the server will have after adding the new IP. For example, to add the server's third IP address, use 1 as the value of[X]
.[ip address]
is the new IP address you're adding to the server.
- Run the following command to bring the new IP online:
/sbin/ifup lo:[X]Where [X] is the same [X] value from the previous steps.