Linux OSes make it insanely easy to bind multiple IP addresses to a single network interface. This is mainly useful for servers, where you often have one ethernet NIC with several several static IPs. In Debian-based OSes such as Ubuntu, all it takes is a changing one file and running one command to add a virtual interface:
First, run the following command to edit your network interfaces file. Feel free to use whatever editor you like… I just prefer nano:
sudo nano /etc/network/interfaces
The file on my virtual machine has a loopback address and a static IP already setup:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
iface lo inet loopback
iface eth0 inet static
The easiest way to add a virtual interface is to copy the existing eth0 entry and change the interface name to eth0:0. Simply copy the entry and change the :0 to :1, :2, etc for each additional virtual interface. Then just change the IP address, and any of the other settings as needed:
iface eth0:0 inet static
Once that is done you can either restart the server, or do it the linux way and just run this command for each interface you’ve added:
sudo ifup eth0:0
And that’s it, now you have multiple IPs. All that’s left is updating your server software to use both IPs, but that’s a topic for another day!