Fix DNS after upgrading to Ubuntu Server 20.04

The way DNS is configured in Ubuntu has become overly complicated in the last few versions. Instead of configuring /etc/network/interfaces, it is now configured using Netplan. But sometimes that doesn't even work because DNS is ultimately controlled by systemd-resolv. systemd-resolv generates /etc/resolv.conf and the default stub DNS uses a local resolver to resolve DNS hostnames. For some reason, after upgrading to Ubuntu 20.04 from 18.04, the local resolver was not started or installed. To fix this, you can't just edit /etc/resolv.conf, you must add your custom DNS servers in /etc/resolvconf/resolv.conf.d/head shown in the image below.

Restart the system and your custom DNS servers should stick.