Adding a failover IP Address to a Dedicated or Virtual Server

In this example the system in question will be hosted at an OVH datacenter thus the information provided will be directly related to an OVH service

First retrieve information with regards to what IP addresses you have been assigned, in this example we will assign      135.532.29.192135.532.29.193 to our server.

Navigate to `/etc/network` & open the `interfaces` inside this file you will see a setup of your current network configuration.

cd /etc/network
nano interfaces

Take care when editing this file as editing the wrong aspects of this file could result in your service going offline!

 You should now see your network configuration, it should look something like this:

# 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
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address xxx.xxx.xxx.xxx
        netmask xxx.xxx.xxx.xxx
        broadcast xxx.xx.xxx.xx
        gateway xxx.xxx.xxx.xxx

You are going to want to take now of the interface id, in our example the interface is labelled eth0, you are going to want to add some information underneath, for a failover IP address you only have to assign an IP & a subnet here is an example using our fake IPs

auto eth0:0
iface eth0:0 inet static
        address 135.532.29.192
        netmask 24

This is an example of a simple block for one IP address, you can see how we have taken our interface ID & added an extra prefix to it, this prefix can be any integer from 0 to 100, this block should be added after your original interface block, so below is the completed example interfaces file with our two ip addresses in.

# 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
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address xxx.xxx.xxx.xxx
        netmask xxx.xxx.xxx.xxx
        broadcast xxx.xx.xxx.xx
        gateway xxx.xxx.xxx.xxx
        
auto eth0:0
iface eth0:0 inet static
        address 135.532.29.192
        netmask 24

auto eth0:1
iface eth0:1 inet static
        address 135.532.29.193
        netmask 24

You can see how we have added two blocks to our interfaces file, & they have different interface prefixes. We will now need to save & exit the file, this can be done by pressing ctrl+x followed by y then pressing the enter key, this will have now saved our interfaces file to disk.

Bringing up the new prefix interfaces is done using the following commands:

ifup eth0:0
ifup eth0:1

This will enable up to use our brand new IP addresses in the system! You can check they have been brought up by running ifconfig this will then show you our two interfaces that we configured!

No Comments

Back to top