Adding IP Addresses to Your Linux Server (Loopback)
Warning: Do not complete these steps if you have a Virtual Private Server (VPS).
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 Add more IP Addresses.
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.
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 Add more IP Addresses.
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 and firewall to accept requests from them.
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 Starting over with My Server (Reprovision)
We automatically configure additional IP addresses for Virtual Private Servers (VPS) — do not complete these steps.
CentOS/Fedora
- Connect to your server via SSH (more info).
- Switch to the root user (more info).
- 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
- Connect to your server via SSH (more info).
- Switch to the root user (more info).
- 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.