« Go Back

Adding Additional IP Addresses or Failover IP Addresses Print

  • IP Addresses, IP, Additional IP, failover ip, failover, Netplan, networkmanager, network manager
  • 27

Debian or NetworkManager

(Debian can also use Netplan, please check to see which Manager you are running.)

  • Open the network configuration file /etc/network/interfaces in a text editor, for example nano:
         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 interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.15.12.123
netmask 255.255.255.0
gateway 195.15.12.1
auto eth0:0
iface eth0:0 inet static
address additional_ip
netmask 255.255.255.255

Note: The interface name eth0 may vary, depending on your OS version and system configuration. Use the ifconfig command to determine the name of your primary network interface.

  • Save the file and exit the editor.
  • Bring up the interface using the following command:
    ifup eth0:0

 

Ubuntu or Netplan

(Ubuntu can use NetworkManager, please check to see which manager you are using.)

  • Open the Netplan configuration file of the main interface in a text editor, for example nano:
    sudo nano /etc/netplan/01-netcfg.yaml

 

  • Edit the network configuration. The IP addresses have to be written with their CIDR notation. The netmask is /24 for the principal IP of the server and /32 for each failover IP. Your configuration should look as in the following example:
    network:
    version: 2
    renderer: networkd
    ethernets:
           enp1s0f0:
           addresses: [196.17.12.12/24, NEWIP/32]
           gateway4: 196.17.12.1
           nameservers:
                    addresses: [ "4.4.4.4", "8.8.8.8" ]

    Tip: Make sure to respect the YAML standards when you edit the file as it might not work if there is a syntax error in your configuration.
  • Activate the new configuration by running the following command:
    • sudo netplan apply
    • You can also use sudo netplan try to test your configuration before using the "apply" command.

Was this answer helpful?