DNS on Ubuntu 18.04 or up

For years it’s been simple to set up DNS on a Linux machine. Just add a couple of entries to /etc/resolv.conf and you’re done.

# Use Google's public DNS servers.

But things change and now it’s not that simple. If you now edit /etc/resolv.conf on Ubuntu you’ll find that the edits are ephemeral. If you restart (or even hibernate) your machine then they’ll be overwritten by default content.


This is pretty simple to fix though.

1. Install the resolvconf package by executing sudo apt install resolvconf

2. Edit /etc/resolvconf/resolv.conf.d/head and add the following:

# Make edits to /etc/resolvconf/resolv.conf.d/head.

3. Restart the resolvconf service by executing sudo service resolvconf restart

Fix should be permanent.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.