The interface name (eth0
in this example) may vary depending on your OS version and system configuration. Use the ifconfig
command to determine the name of your primary network interface.
How to configure a Dedibox failover IP on Debian and Ubuntu
This guide provides step-by-step instructions for configuring a Dedibox failover IP on Debian and Ubuntu Linux. A failover IP is a secondary IP address that can be assigned to your server.
Before you startLink to this anchor
To complete the actions presented below, you must have:
Failover IP configuration on DebianLink to this anchor
- Connect to your server using SSH and open the network configuration file
/etc/network/interfaces
in a text editor, such asnano
:
nano /etc/network/interfaces
- Add the failover IP to the configuration as shown in the following example:
# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceauto eth0iface eth0 inet staticaddress 195.154.123.123netmask 255.255.255.0gateway 195.154.123.1auto eth0:0iface eth0:0 inet staticaddress ip_failovernetmask 255.255.255.255
- Save the file and exit the editor. Bring up the interface using the following command:
ifup eth0:0
Failover IP configuration on Ubuntu (Netplan)Link to this anchor
Since Ubuntu 18.04, Netplan has been the default network configuration system.
- Disable cloud-init network configuration to prevent conflicts with Netplan:
sudo mkdir -p /etc/cloud/cloud.cfg.decho 'network: {config: disabled}' | sudo tee /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
This step is necessary to prevent cloud-init from overriding the Netplan configuration.
- Backup the existing Netplan configuration and create a new file:
sudo cp /etc/netplan/50-cloud-init.yaml /etc/netplan/01-myplan.yamlsudo mv /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml-backup
- Edit the new Netplan configuration file
/etc/netplan/01-myplan.yaml
usingnano
:
network:renderer: networkdethernets:enp5s0:critical: truedhcp-identifier: macdhcp4: falsedhcp6: falseaddresses:- 51.111.222.333/24 # Server main IP (/24)- 212.111.222.333/32 # Alternate IPs / IP redirects (/32)- 212.111.222.334/32- 212.111.222.335/32routes:- to: 0.0.0.0/0via: 62.210.0.1metric: 1on-link: truenameservers:addresses:- 51.159.69.156- 51.159.69.162enp6s0:dhcp4: truedhcp4-overrides:use-routes: falseroutes:- to: 10.88.0.0/13 # Use appropriate IP/gateway from DHCPvia: 10.89.23.129version: 2
Ensure that indentation and formatting are correct to avoid YAML syntax errors.
- Run the following command to test the configuration:
sudo netplan try
- If everything works as expected, apply the configuration:
sudo netplan apply
If there is an error in your configuration, it might render your network inaccessible. You may need to revert changes using KVM/IPMI access.
TroubleshootingLink to this anchor
If you encounter issues with your network configuration, check the logs using:
sudo journalctl -u systemd-networkd --no-pager
You can also refer to the official Canonical repository for more Netplan examples and troubleshooting guides.