An FoIP (Failover IP) or Floating IP is an address that is not bound to a specific device and therefore can be moved. In this article, we will cover how to configure an FoIP as an alias within Ubuntu.
Prerequisites
- Dedicated Server
- Getting Started with Failover IP Addresses
Topics
Configuring an FoIP Address within Ubuntu 16.04
To begin, use the ip
command to list the network interface name(s):
$ ip addr
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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:00:5e:00:53:3a brd ff:ff:ff:ff:ff:ff inet <SERVER'S_IP>/24 brd <SERVER'S_BROADCAST> scope global eth0 valid_lft forever preferred_lft forever inet6 <SERVER'S_IPv6>::/64 scope global valid_lft forever preferred_lft forever inet6 fe80::a6bf:1ff:fe1a:57c2/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 00:00:5e:00:53:3b brd ff:ff:ff:ff:ff:ff
eth0
in our example, is used for public (i.e., Internet) traffic. The second one, eth1
in our example, is used for private networking. For more information on this, please check out our Getting Started with vRack article.From the output, note the public interface name, which for us is eth0
.
Next, open the /etc/network/interfaces
file using a text editor of your choice:
$ sudo vi /etc/network/interfaces
Then, assign your FoIP to a subinterface, also known as a virtual interface, by adding the following to the file:
auto eth0:1 iface eth0:1 inet static address <FAILOVER_IP> netmask 255.255.255.255
eth0
) with your actual interface name followed by an unused subinterface (e.g., :1
) and a FoIP address that is assigned to your server.Finally, use the systemctl
command to restart the networking service:
$ sudo systemctl restart networking
Job for networking.service failed because the control process exited with error code. See "systemctl status networking.service" and "journalctl -xe" for details.
Comment (#) out the following lines under the
iface eth0 inet6 static
section of the /etc/network/interfaces
file:#post-up sleep 5; /sbin/ip -family inet6 route add <IPv6_GATEWAY> dev <INT>
#post-up sleep 5; /sbin/ip -family inet6 route add default via <IPv6_GATEWAY>
Then, flush the interface and restart the networking service with the following command:
$ sudo ip addr flush dev <INT> && systemctl restart networking
Lastly, from your local machine, use the ping
command to test that the system can communicate via the FoIP address:
$ ping <FAILOVER_IP>
If you do not receive a response, review the configuration for any inaccuracies and/or restart the operating system.
Configuring an FoIP Address within Ubuntu 18.04
Canonical, the developer of Ubuntu, implemented the use of Netplan for easy-to-use network configuration as of version 17.x. However, as of this writing, a known issue with IPv6 configuration exists between Netplan and systemd.network
(the system service that manages networks). Although we are working with an IPv4 address, each Dedicated server is configured with an IPv6 address, which means network configurations are stored with systemd.network
directly. As a result, we will be adding to its configuration file, bypassing Netplan entirely.
To begin, open the /etc/systemd/network/50-default.network
file using a text editor of your choice:
$ sudo vi /etc/systemd/network/50-default.network
Then, add the following to the file, under the [Network]
section:
Address=<FAILOVER_IP>/32
Finally, use the systemctl
command to restart the networking service, which applies the configuration:
$ sudo systemctl restart systemd-networkd
Lastly, from your local machine, use the ping
command to test that the system can communicate via the Failover IP address:
$ ping <FAILOVER_IP>
If you do not receive a response, review the configuration for any inaccuracies and/or restart the operating system.
Conclusion
Having read this article, you should be familiar with the steps required to configure an interface with an additional IP address within Ubuntu.
Comments
0 comments
Please sign in to leave a comment.