Verified and Tested 2/22/15
This how-to will walk you through the process of adding an additional IP to your Ubuntu or Debian server. In order for an additional IP to work properly, it must be added to both the cloud interface and your server.
– Root privileges
– A reserved additional IP. You can find out how to reserve an additional IP here.
Add an Additional IP to Your Ubuntu or Debian Server
To add this IP to your server’s network interface, you will need to edit your /root/etc/network/interfaces file, but first we should back it up in case of any mistakes. To do this, make sure you are one the root account on your server and use the following command:
cp /etc/network/interfaces /etc/network/interfaces.backup
Once copied, we can view and edit the file with nano:
Once there, you should see something like this:
auto lo iface lo inet loopback
auto eth0 iface eth0 inet static hwaddress ether 00:00:45:1c:5e:d6 address 192.168.0.1 netmask 255.255.252.0 gateway 192.168.0.1
dns-nameservers 126.96.36.199 188.8.131.52
We want to add our IP below the eth0 and name it eth0:0. It should look something like this:
auto eth0 iface eth0 inet static hwaddress ether 00:00:45:1c:5e:d6 address 192.168.0.25 netmask 255.255.252.0 gateway 192.168.0.1
auto eth0:0 iface eth0:0 inet static address 192.168.0.26 netmask 255.255.252.0
Because this new IP is going to be set on the same Ethernet port, you will want to set this as eth0:0 and not eth1. All you will need to add is the new address and its netmask. Once you have this set, save and restart your server either within your cloud control panel or with this command:
shutdown –r now
Once the server has finished rebooting, your new IP will be set!