Category : How-to
In a previous post, we saw how to create a virtual IP address, based on an existing network interface. The trouble with this method is that the virtual IP address will vanish when you reboot your machine.
On option is to attach the script to the network up and down scripts however there is a much easier way!
In Debian/ Ubuntu you simply create a new, virtual interface in the interfaces file.
And add a network interface, based on an existing interface. The below example is a virtual IP based on eth0 – note if this is your second virtual IP you would use eth0:2, and so on.
iface eth0:1 inet static
You will need to change the IP addresses to match your network. Notice there is no gateway – usually you can only have one gateway per machine.
Restart networking for the changes to take effect.