Wednesday 27 December 2017

Adding an IP alias to OVH dedicated server

So, as you may have guessed, recently I've moved hosting from a dedicated server at Lunarpages, to a dedicated server at OVH. Lunarpages kept the system I was on going reliably for years (indeed, I'm slowly still migrating services from it), but just couldn't match what I got included by OVH.

Anyway, to keep some things separate, I like to use separate public IPs for them. In the past, you'd just add a stanza to /etc/network/interfaces, and your work was done... but I opted for Ubuntu Server 17.10, and well - it does things differently!

Initially, I browsed around and found that there was no /etc/network/interfaces, so I assumed correctly that something later has replaced it. I did some googling and found that, indeed, Ubuntu 17.10 is released standard with "netplan". You declare your network configuration in netplan, and then from the declarative configuration, netplan then talks to whatever network management engine you've chosen and goes and configures the interfaces.

... so I went off, and did some quick reading on netplan, and all was right with the world.


Whilst netplan is the default for Ubuntu 17.10, it's not the default for OVH deployed servers. OVH deploy their servers using our favourite system monolith, systemd. So instead of editing things in /etc/netplan/01-netcfg.yaml, I needed to look in /etc/systemd/network:

/etc/systemd/network# ls
root@daserver:/etc/systemd/network# egrep '^\s*[^#]' 50*[Match][Network] interface on public network, with default route[Address][Address][Route][Match][Link] interface on public network, with default route database onboard slot path mac

I had to add the highlighted [Address] block to the provided /etc/systemd/network/ file and then perform systemctl restart systemd-networkd. Unlike previous versions of linux where it'd create an alias interface and appear in an ifconfig as a separate network interface, it now only appears via:

# ip address show eno3
2: eno3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether XXXHARDWAREMACXXX brd ff:ff:ff:ff:ff:ff
       valid_lft forever preferred_lft forever
    inet XXXALIASIPXXX/32 brd XXXALIASBROADCASTXXX scope global eno3
       valid_lft forever preferred_lft forever
    inet6 XXXPRIMARYIPv6XXX scope global 
       valid_lft forever preferred_lft forever

Am sure this is self explanatory to some - but I learned how to configure linux using /etc/network/interfaces, so dealing with systemd and netplan is new territory for me.

Incidentally, when I searched OVH's documentation, I initially found:
Configure a failover IP with Ubuntu
... but then when I searched again I found:
Configuring IP Aliasing: Debian 9+, Ubuntu 17+, Fedora 26+ and Arch Linux">Debian 9+, Ubuntu 17+, Fedora 26+ and Arch
... the caveat with the above link is that it's missing a d from the end of:

systemctl restart systemd-networkd <-- There needs to be a d on the end here

No comments:

Post a Comment

Hey... thanks for leaving a comment! Due to Casino spam, I've had to turn on moderation for some of the posts. Apologies - I do read every comment left!