Adding a Failover IP Address in a VM
You will also need the Primary IP address of the hyper-visor, this will be used as the gateway for the VM
ip addr showwhich should give the output of your current network connections along with the assigned MAC ADDRESS with the interface, here is an example of the output from a virtualization system
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether fa:16:3e:8e:5b:cf brd ff:ff:ff:ff:ff:ff inet x.x.x.x/32 brd x.x.x.x scope global ens3 valid_lft forever preferred_lft forever
link/etherour Mac Address assigned to the network interface, we will also need to note the interface ID so for this example it is
Below is an example without any actual values for the addressing, copy and pasting this without editing will accomplish nothing!
auto eth0 iface eth0 inet static address FailoverIP netmask 255.255.255.255 broadcast FailoverIP post-up route add HYPERVISOR_GATEWAY dev eth0 post-up route add default gw HYPERVISOR_GATEWAY post-down route del default gw HYPERVISOR_GATEWAY post-down route del HYPERVISOR_GATEWAY dev eth0 dns-nameservers 188.8.131.52 184.108.40.206
Above you can see with have
HYPERVISOR_GATEWAY both of these must contain values specified to your network environment!
FailoverIP should be pretty self explanatory, it is the IP address supplied by your Host as it looks on the panel / email sent to you. For this example we are going to use
HYPERVISOR_GATEWAY Is a little different, you are going to want to obtain the primary IP address of your hyper visor for this example we are going to use
158.325.72.2, you are going to need to alter this IP address as we want the gateway for the hyper visor not the hyper visor itself, this can be done by changing the last prefix to
254 for context the whole IP address should now look like
158.325.72.254 this is your final
If we combine all of this together your final complete interface block should be
auto eth0 iface eth0 inet static address 220.127.116.11 netmask 255.255.255.255 broadcast 18.104.22.168 post-up route add 158.325.72.254 dev eth0 post-up route add default gw 158.325.72.254 post-down route del default gw 158.325.72.254 post-down route del 158.325.72.254 dev eth0 dns-nameservers 22.214.171.124 126.96.36.199
You should save and exit your interfaces file with the network block of your interface edited.
Once done you should restart your base networking setup using
service networking restart
You are now done!