To be fair, I still have no idea how to set the DNS server on an Ubuntu server in a way that won’t get wiped out on reboot. Is it resolv.conf? Nope, that’s generated by another tool. systemd-resolve? I think that’s getting closer… network manager? By the time I figure it out they’ll add another one to the pile.
The network config for out-of-the-box Ubuntu server has been stable for 6 years. You need to modify netplan's config: /etc/netplan/*.yaml (default is 00-installer-config.yaml). This renders volatile systemd-networkd configs in /run/systemd/network which, in turn, will configure systemd-resolved appropriately.
If you've opted out of netplan, then you need to configure one of systemd-networkd or NetworkManager manually (on server, NetworkManager is only present if you've installed it).
I personally used to be opposed to netplan but I had to do some very esoteric network configuration which was super easy with netplan.
Ah right, I remember I ended up writing a netplan YAML. I still couldn’t get it to persist across reboots, and just resorted to running “sudo netplan apply” every time it rebooted.