How to update nameservers on Ubuntu 22.04 jammy

Ubuntu 22.04 changed the way nameservers are defined. Now it uses “netplan”. It’s possible to update the nameservers with netplan by editing the YAML configuration file. But if you’re old-school or just don’t like netplan, here’s how to update the nameservers in your /etc/resolv.conf file the correct way…

Start by installing package “resolvconf”: apt-get install resolvconf

Next, edit file /etc/resolvconf/resolv.conf.d/head. Update the nameservers there. Then run these two commands:

resolvconf --enable-updates
resolvconf -u

After that, you can look at /etc/resolv.conf to verify that your nameservers were correctly propagated. And that’s it!

Leave a Comment