In the old days setting up DNS was easy. You edited /etc/resolv.conf, put your nameservers in there, and you were done. Sadly it’s gotten more complicated as time goes on; DHCP provides nameservers, computers have multiple network interfaces, you want different DNS servers on a laptop depending on where you are.
But the resolvconf(8) system in Ubuntu is impenetrably complex to configure. I’ve found a bunch of random places where name servers are stored or written. I thought that /etc/network/interfaces is canonical. But there’s stuff in /etc/resolvconf/ too, and things cached in /run/resolvconf/, and I have no idea how to just add a name server. Various “obvious” things fail with old configs coming from some cache.
AskUbuntu has a decent answer that while it may not be correct, works. Edit /etc/resolvconf/resolv.conf.d/head (ignoring the warning about autogeneration), add your entry, then run resolvconf -u. I just tried it and it worked, even put my entries first in the list.
My real goal was to replace my ISP’s flaky DNS server with Google’s 188.8.131.52. It’s stupid in the modern era that DNS is still a sequential operation with a 5 second timeout. This Ask Ubuntu answer suggests installing a fancy caching DNS server like pdns.