Configuring an Additional IP Address on a Linux Server

This document will take you through the process of adding an additional IP address to a Linux Server Network Configuration. The files you need to amend vary based on the distribution of Linux installed; however, all changes are executed at the command line that is accessed via SSH using the default IP address of your server.

To get SSH access, you will need your root password (displayed in the Control Panel) and an SSH client. We recommend Putty, which can be downloaded for free at:

How To Configure A Static Network IP Address On Linux

Consult the guide, Connecting to a Linux Server via SSH for instructions on how to download and configure Putty to launch the terminal window with the command line.

Follow the below steps once you have a terminal window open:

Configuring an IP Address for Ubuntu & Debian

  1. Open /etc/network/interfaces. An example of the file is below:
    Screen 1
    (Screen 1)
  2. Below the line:
    auto eth0

    Add the following line:
    auto eth0:1
  3. Below the first interface description iface eth0 add the description of the second interface:

    iface eth0:1 inet static

    Make sure the mask and gateway are correct. These would be identical to the ones already specified. The only thing that changes is the IP address you want to add. The resulting file should look like this:
    Screen 2
    (Screen 2)

Configuring an IP Address for Centos

The process for Centos is slightly different in that you create a new interface file instead of amending and adding to the existing one.

  1. Go to the following directory on your server:
    Screen 3
    (Screen 3)

    If you do an ls on this directory, you will see several files listed as illustrated below:
    Screen 4
    (Screen 4)
  2. Verify which interface you will use to add IP addresses. Typically, this will be eth0 for public IP addresses. Type:

    This will produce output similar to the following:
    Screen 5
    (Screen 5)
  3. Make a copy of ifcfg-eth0 for each IP you wish to add and name them ifcfg-eth0>:0ifcfg-eth0:1, as shown below. Press 'Return' after each cp command:
    Screen 6
    (Screen 6)
  4. Open each command and change the DEVICE, IPADDR and NETMASK fields accordingly. A sample entry for each file would look like this:
    Screen 7
    (Screen 7)
  5. Restart the network service:
    Screen 8
    (Screen 8)

    Apply the changes made to the network configuration. Watch for any errors identified when restarting the service.
  6. Use the following command again to verify the IP address assigned to your server:


    Try to get SSH access to the server using the newly-added IP address to make sure it has been correctly added and is properly working.
  7. To add a new IP address, open Netplan configuration file '/etc/netplan/50-cloud-init. yaml' in your preferred text editor, and add a new IP address in the IP address column as shown below: Once changes are made, save and close the file. Execute the following command to enable the new configuration.
Next Post Previous Post
No Comment
Add Comment
comment url