How to Configure a failover IP
Configuring the failover IP with Ubuntu
You may need to configure a failover IP address on your instances, for one of the following reasons:
- * you have a large number of websites on your instance,
- * you host international projects,
In order to do this you can either buy or import a failover IP address for your Public Cloud instances.
However failover IPs will not be automatically configured on your instance.
This guide explains how to configure your instance’s network interface so that a failover IP can be allocated to it.
Configuring the interface
- Edit the configuration file with the following command:
vi /etc/network/interfaces
- Add the following lines to the end of the file:
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address should-be-your-main-ip
netmask 255.255.255.255
post-up /sbin/ip route add 158.69.192.1 dev eth0
post-up /sbin/ip route add default via 158.69.192.1
pre-down /sbin/ip route del default via 158.69.192.1
pre-down /sbin/ip route del 158.69.192.1 dev eth0
dns-nameserver 213.186.33.99
dns-search vps.ovh.ca
auto eth0:0
iface eth0:0 inet static
address your-failover-ip
netmask 255.255.255.255
post-up /sbin/ifconfig eth0:0 your-failover-ip netmask 255.255.255.255 broadcast your-failover-ip
pre-down /sbin/ifconfig eth0:0 down
If you have many IPs to allocate, they must be added on the same line:
by increasing the value of Y (the alias number)
– Restart the network services with the command:
-
- Restart the network services with the command:
service networking restart
Configure a failover IP with CentOS
- you have a large number of websites on your instance,
- you host international projects.
In order to do this you can either buy or import a failover IP address for your Public Cloud instances.
However failover IPs will not be automatically configured on your instance.
This guide explains how to configure your instance’s network interface so that a failover IP can be allocated to it.
Requirements
- You must have a failover IP address
Configuring the interface
-
- Edit the configuration file with the following command:
vi /etc/sysconfig/network-scripts/ifcfg-ethX:Y
# Variables | #Values |
X | main interface number (usually eth0 ) |
xxx.xxx.xxx.xxx | failover IP to configure |
Y | the number of the alias (starting at 0 and the etc. depending on the number of IPs there are to configure) |
Add these lines to the file:
DEVICE="ethX:Y" BOOTPROTO=static IPADDR="xxx.xxx.xxx.xxx" NETMASK="255.255.255.255" BROADCAST="xxx.xxx.xxx.xxx" ONBOOT=yes Your file should look like this: DEVICE="eth0" BOOTPROTO="dhcp" IPV6INIT="yes" NM_CONTROLLED="yes" ONBOOT="yes" TYPE="Ethernet" NOZEROCONF=1 DEVICE="eth0:1" BOOTPROTO=static IPADDR="failver-ip" NETMASK="255.255.255.255" BROADCAST="failver-ip" ONBOOT=yes
Restarting the network service
-
- Reboot the network services with the command:
/etc/init.d/network restart