OVH / SoYouStart IP failover / alias – Ubuntu 18.04 + netplan

Introduction

OVH and SoYouStart offer free failover IP’s with dedicated servers. You initially request a new failover IP address directly with OVH / SoYouStart – just login to your control panel and request a new failover IP. Once you have received your new IP(s) you have to manually assign them to your server (it’s not automatic).

Below is a screenshot of the SoYouStart IP request:

SoYouStart failover IP ordering

Once you have been supplied the requested IP failover / IP alias, it will appear under allocated to your chosen server.

OVH / SoYouStart Failover IP allocated

Let us assume we requested 2 ips and were given the following:

  • Failover 1: 123.45.67.8
  • Failover 2: 123.45.67.99

Configuring your new failover IP in Ubuntu 18.04

Now that we have our IP, it won’t automatically be configured on the actual Ubuntu 18.04 server. You have to do this manually.

Unfortunately Ubuntu 18.04 no longer includes ifupdown as default. Instead netplan is bundled for network interfacing. You can install ifupdown and use that but you may as well get used to netplan moving forward.

If you want to go back to ifupdown, read details here: https://netplan.io/faq#how-to-go-back-to-ifupdown

Before we begin

First all of we need to take note of your current servers ethernet card details (assuming you only have one ethernet card). We need the following details:

  • Network interface name
  • MAC address

Type in the following command to get these details:

[email protected]:/# ifconfig

Hopefully you get an output similar to the following:

ifconfig-mac-address

I have highlighted in green and yellow the network interface name and mac address for my server. We are going to use this information to help configure the new IP failover using netplan.

  • Network interface name: eno1
  • MAC address: x8:50:f6:2x:67:8x

Configuring netplan

The first thing is to create a new custom netplan configuration file. Head over to your /etc/netplan folder and create a new empty configuration file (call it anything but it must end with a .yaml extension).

I’m going to call my file config.yaml. I am going to use nano editor but feel free to use whatever you are comfortable with.

[email protected]:/# cd /etc/netplan
[email protected]:/etc/netplan# nano config.yaml

If we go back and list all the information we have gathered, we are going to use this information in our new config.yaml file to bind the 2 new failover IP’s to our server:

  • Network interface name: eno1
  • MAC address: x8:50:f6:2x:67:8x 
  • Failover 1: 123.45.67.8
  • Failover 2: 123.45.67.99

Paste and edit the following in to your empty config.yaml:

network:
version: 2
ethernets:
eno1:
dhcp4: true
match:
macaddress: x8:50:f6:2x:67:8x
set-name: eno1
addresses:
- 123.45.67.8/32
- 123.45.67.99/32

Note: It is very important that the indentation is correct since this is a YAML file and YAML syntax has fixed indentation rules (more on that here: https://docs.saltstack.com/en/latest/topics/yaml/).

If you do not have the correct indentation, it is likely netplan will throw an error when you try to test / restart it.

As you can see we have populated the details such as the Network Interface Name (eno1),MAC address (x8:50:f6:2x:67:8x) and added each of our failover IP’s after the line addresses:

             addresses:
- 123.45.67.8/32
- 123.45.67.99/32

We have then also added a subnet mask of /32 to each of the IP’s.

Save the file and exit the editor.

Testing the new netplan configuration

Now that we have successfully saved our file, we want to test it to see if it works, run the following command netplan try:

[email protected]:/etc/netplan# netplan try

You should see a successful output like the following:


[email protected]:/etc/netplan# netplan try
Configuration accepted.

Excellent – now that we have verified the configuration looks good, lets apply the changes: Run the command netplan apply.


[email protected]:/etc/netplan# netplan apply

Now all we need to do is verify that the new failover IPs have been assigned to the server, run the command ip addr list:

[email protected]:/etc/netplan#  ip addr list
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
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: mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether x8:50:f6:2x:67:8x brd ff:ff:ff:ff:ff:ff
inet 123.45.67.8/32 scope global eno1
valid_lft forever preferred_lft forever
inet 123.45.67.99/32 scope global eno1
valid_lft forever preferred_lft forever
inet 91.121.xx.xx/24 brd 91.121.xx.xx scope global dynamic eno1
valid_lft 587sec preferred_lft 587sec
inet6 fe80::xx40:x2xx:xe3x:678x/64 scope link
valid_lft forever preferred_lft forever

As you can see, our new failover IP’s have been assigned to the server.

2 Comments

  • Great tutorial but can you help me with this error, please.

    An error occurred: the configuration could not be generated
    Reverting.
    [email protected]:/etc/netplan# netplan apply
    /etc/netplan/50-cloud-init.yaml:10:13: Error in network definition: address '54.xxx.xxx.7' is missing /prefixlength
    - 54.xxx.xxx.7

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.