There are a lot of reasons you may want to add an additional IP under your Linux dedicated or VPS server. In most cases your hosting provider shall be able to allocate and route additional IP address on request. When you request a new IP it’s quite possible to be asked about the purpose you’re going to use it for, known as justification. Additional IPs will cost you a couple of more bucks and the price depends from provider to provider. Once your request is accepted the IP will be routed to your server and you’re ready to go. Now you have to configure the new IP under your linux box. Depending on the linux distribution used the steps are slightly different.
For both Debian and CentOS you have to define network interface aliases.
Under Debian edit your /etc/network/interfaces file and add a code block like the one below containing the alias, the IP address and the netmask. Note you cannot specify gateway and dns-nameservers for an alias. The example below adds an IP address with alias eth0:0 and IP 192.168.100.1.
iface eth0:0 inet static
With CentOS you have to create a new file for each IP you’d like to define under /etc/sysconfig/network-scripts directory. The file have to be named ifcfg-eth0:X where X is the alias number starting from 0 and eth0 is the actual network interface.
You can bring up all the additional IPs by calling: