How to add failover/ alias IP address in Linux

This tutorial will be quite short because the procedure for adding IP addresses is almost the same for all Linux distributions and it’s easy. However I must mention that I tested this on Ubuntu 16.04.

So you received your failover IP in standard format This method is permanent static setup which will be loaded during OS boot

Open /etc/network/interfaces file:

nano /etc/network/interfaces

Assuming that eth0 is your network interface you want to add failover IP address add following at the end of the file:

auto eth0:0
iface eth0:0 inet static

So as you can see every IP alias has index number starting with zero for first IP and continuing with every additional IP alias. So the pattern is:

auto ethX:Y
iface ethX:Y inet static

Finally you should restart network service using:

systemctl restart networking

And don’t forget sudo if you’re working with non-root user. Useful command for checking network interfaces is:

ifconfing -a

If you need to add IP only temporary (until next reboot) you can do this:

ip addr add dev eth0

Leave a Reply

Your email address will not be published. Required fields are marked *