Skip to main content

Configure a Failover IP

This guide explains how to configure a Failover IP on your Linux VPS.

Prerequisites

  • SSH root or sudo access
  • A Failover IP assigned to your VPS
  • Debian/Ubuntu system

Configuration with ifupdown (/etc/network/interfaces)

Legacy method used on Debian and older Ubuntu versions. If your system uses Netplan (Ubuntu 18.04+), refer to the next section.

  1. Disable automatic network configuration:

    sudo nano /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

    Add this line:

    network: {config: disabled}
  2. Configure the virtual interface:

    sudo nano /etc/network/interfaces.d/50-cloud-init

    Add these lines:

    # Failover IP interface
    auto eth0:1
    iface eth0:1 inet static
    address YOUR_FAILOVER_IP
    netmask 255.255.255.255
  3. Restart the network service:

    sudo systemctl restart networking

Configuration with Netplan (Ubuntu 18.04+)

On recent Ubuntu-based systems, the network is managed by Netplan rather than by /etc/network/interfaces. Use this method instead of the previous section.

  1. Identify your network interface name:

    ip a

    (for example eth0, ens3 or enp1s0)

  2. Edit the Netplan configuration file:

    sudo nano /etc/netplan/50-cloud-init.yaml

    Add the Failover IP to your interface, keeping the existing configuration (mind the YAML indentation, 2 spaces):

    network:
    version: 2
    ethernets:
    eth0:
    addresses:
    - YOUR_FAILOVER_IP/32
  3. Apply the configuration:

    sudo netplan apply

Tip: use sudo netplan try instead of netplan apply to test; the configuration is automatically rolled back after 120 seconds if you don't confirm it, which prevents losing SSH access in case of an error.

Verification

  1. Verify that the IP is properly configured:

    ip addr show eth0:1
  2. Test connectivity:

    ping -I YOUR_FAILOVER_IP 8.8.8.8

Best practices

  • Document your network configurations
  • Test the configuration before any production deployment
  • Keep a backup of configuration files
  • Configure alerts in case of connectivity loss

Troubleshooting

  • Check system logs: sudo journalctl -xe
  • Check network configuration: sudo networkctl status
  • Make sure the IP is properly assigned to your VPS
  • Verify there is no IP conflict

Important notes

  • The Failover IP must be configured with a network mask 255.255.255.255
  • Some services may require reconfiguration to use the new IP
  • Configuration may vary depending on your Linux distribution