Configuring a Failover IP in Debian via /etc/network/interfaces
On Debian systems, to assign a failover IP you need to edit the /etc/network/interfaces file with the appropriate network parameters.
Technical notes
- The subnet must be set to 255.255.255.255 (i.e., /32).
- With /32, both network and broadcast must match the failover IP exactly.
- The default gateway must be the physical host’s IP ending in .254 (never the failover IP).
- Because this configuration is not inherently valid for the VM, routes to the gateway must be added manually via route add.
Below is an example configuration using the failover IP 5.6.7.8 and gateway 123.4.5.254:
auto eth0
iface eth0 inet static
address 5.6.7.8
netmask 255.255.255.255
broadcast 5.6.7.8
post-up route add 123.4.5.254 dev eth0
post-up route add default gw 123.4.5.254
post-down route del default gw 123.4.5.254
post-down route del 123.4.5.254 dev eth0