Contabo: DNS Lookup Timeouts
How I fixed a bunch of DNS problems on my Contabo server.
This blog (and a bunch of internal services)
are were running on a Ubuntu 20.04 VPS hosted by Contabo, a German low-cost webhoster. General availability is fairly good so far and the amount of available memory is generous compared to (for example) Hetzner or OVHcloud.
As you might expect, the low price point does come with a few drawbacks. Most of these drawbacks (like automated backups taken by the provider) are fine with me given the price. However, one problem I did run into very frequently and which caused a lot of trouble were failed DNS lookups.
In Node.js applications you might see errors such as
getaddrinfo EAI_AGAIN baserow.io, using the
nslookup baserow.io command on your shell you might get an
;; connection timed out; no servers could be reached error instead.
This was particularly annoying in my RSS reader (which fetches new posts in the background, meaning I wouldn’t immediately notice problems).
systemd-resolve --status | grep 'DNS Servers' -A2 reveals the revolvers in use:
The same DNS lookups seem to be working fine when manually specifying a DNS server such as Quad9 (188.8.131.52):
So in order to solve the problem, I simply needed to replace the default Contabo DNS servers in the
/etc/netplan/01-netcfg.yaml file pre-filled by Contabo. Simply comment out the problematic ones under network > ethernets > ens18 > nameservers > addresses and add working IPs instead such as the ones provided by Quad9 or Google.
After editing the file, the
sudo netplan apply command applies the changes and another round of
systemd-resolve --status | grep 'DNS Servers' -A2 should return the working DNS servers: