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:
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
- Open /etc/network/interfaces. An example of the file is below:
- Below the line:
Add the following line:
- Below the first interface description
iface eth0add 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:
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.
- Go to the following directory on your server:
If you do an ls on this directory, you will see several files listed as illustrated below:
- 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:
- Make a copy of
ifcfg-eth0for each IP you wish to add and name them
ifcfg-eth0:1, as shown below. Press 'Return' after each cp command:
- Open each command and change the DEVICE, IPADDR and NETMASK fields accordingly. A sample entry for each file would look like this:
- Restart the network service:
Apply the changes made to the network configuration. Watch for any errors identified when restarting the service.
- 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.
* The offer is £100 Cloud Hosting credit when purchasing any Cloud Hosting plan using the displayed voucher code. This credit is only redeemable for 30 days following the qualifying purchase. This offer is restricted to new customers only, cannot be applied to renewals and used in conjunction with any other offer and may be withdrawn at any time at the discretion of Simply Cloud Limited. Any customers who do not use the voucher code - 100CREDIT, will receive £10 credit, this credit is only redeemable for 30 days following the qualifying purchase. All prices displayed are exclusive of VAT, please note, for EU customers VAT rates payable will be subject to your country of residence.