Skip to main content

Configure a Failover IP

This guide explains how to configure a Failover IP on your Linux VPS. Choose the section matching your distribution and its network manager.

Prerequisites

  • SSH root or sudo access
  • A Failover IP assigned to your VPS
  • Linux system (Debian, Ubuntu, AlmaLinux, Rocky Linux, Fedora…)

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.

Configuration with network-scripts (AlmaLinux / Rocky Linux 8 and 9)

On RHEL-based distributions (AlmaLinux, Rocky Linux 8 and 9), create a dedicated configuration file for the virtual interface.

  1. Identify your network interface name:

    ip a

    (for example eth0 or ens3)

  2. Create the alias configuration file:

    sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0:1

    Add these lines:

    DEVICE=eth0:1
    BOOTPROTO=static
    IPADDR=YOUR_FAILOVER_IP
    NETMASK=255.255.255.255
    ONBOOT=yes
  3. Restart the network service:

    sudo systemctl restart NetworkManager

Configuration with NetworkManager (Fedora, AlmaLinux, Rocky Linux)

On Fedora and recent versions of AlmaLinux and Rocky Linux, the network is managed directly through NetworkManager connection files.

  1. Identify your interface connection file:

    ls /etc/NetworkManager/system-connections/
  2. Edit the matching connection file (for example cloud-init-eth0.nmconnection):

    sudo nano /etc/NetworkManager/system-connections/cloud-init-eth0.nmconnection

    In the [ipv4] section, add the Failover IP:

    [ipv4]
    method=auto
    address1=YOUR_FAILOVER_IP/32
  3. Restart NetworkManager:

    sudo systemctl restart NetworkManager

Verification

  1. Verify that the IP is properly configured:

    ip addr show
  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
  • As a last resort, boot your server in rescue mode and add the IP on the fly: ip addr add YOUR_FAILOVER_IP/32 dev eth0

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