Configure an IP Failover on CoreOS

This documentation explains how to configure a failover IP on servers installed with CoreOS.

Configuration on the Server

The configuration must be set as explained on official documentation.

1. Edit/create the file /etc/systemd/network/20-multi_ip.network:

[Match]
Name=eno1

[Network]
DNS=62.210.16.6
DNS=62.210.16.7
Address=62.210.xx.xx/24
Gateway=62.210.xx.1
Address=212.83.xx.xx/32
You need to replace eno1 with your network interface name.

The DNS servers used in this configuration example are the ones of Online, you can keep these values.

The first Address line is the primary IP address of the physical server, followed by /24 (CIDR notation).

The gateway IP address has the same first 3 bytes as the server's IP followed by .1.

i.e.: 62.210.84.1

For each additional IP, add a new line Address with the failover IP, followed by /32 (CIDR notation).

Then restart your network services to activate these new settings:

sudo systemctl restart systemd-networkd.

You should see your two new IP addresses by typing:

ip addr show.

Example :

ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether c8:1f:66:c9:2e:f2 brd ff:ff:ff:ff:ff:ff
    inet 62.210.xx.xx/24 brd 62.210.xx.255 scope global eno1
       valid_lft forever preferred_lft forever
    inet 212.83.xx.xx/32 brd 212.83.xx.xx scope global eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::ca1f:66ff:fec9:2ef2/64 scope link 
       valid_lft forever preferred_lft forever
3: eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc mq state UP group default qlen 1000
    link/ether c8:1f:66:c9:2e:f3 brd ff:ff:ff:ff:ff:ff
    inet 10.90.xx.xx/26 brd 10.90.215.127 scope global eno2
       valid_lft forever preferred_lft forever
    inet6 fe80::ca1f:66ff:fec9:2ef3/64 scope link 
       valid_lft forever preferred_lft forever