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.

When you receive additional IPs for your server, you have to configure your server and firewall to accept requests from them.

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

  1. Connect to your server via SSH (more info).
  2. Switch to the root user (more info).
  3. Run the following command to switch to the folder where the network configuration scripts are located:
    cd /etc/sysconfig/network-scripts
  4. Run the following command to view the current network adapters:
    ls ifcfg*
    Your server's primary IP displays as ifcfg-eth0 and ifcfg-lo; additional IPs display as ifcfg-lo:0, ifcfg-lo:1, etc.
  5. 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].
  6. 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.
  7. 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

  1. Connect to your server via SSH (more info).
  2. Switch to the root user (more info).
  3. Run the following command to switch to the folder where the network configuration scripts are located:
    cd /etc/network/
  4. In a text editor, open the file interfaces. Your server's primary IP displays as eth0; additional IPs display as lo:0, lo:1, etc.
  5. 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.
  6. 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.

Was This Article Helpful?
Thank You For Your Feedback
Glad we helped! Anything more we can do for you?
Sorry about that. How can we be more helpful?