Solving weird DNS resolv.conf issues on Ubuntu using the resolvconf service

Background

Ubuntu has this fancy system where by /etc/resolv.conf isn’t actually a proper resolver but refers to a local server called 127.0.0.53. In some circumstances this is a pain because it feels you don’t have control over basic functionality of a PC.

When you start googling what’ s going on, you end up with 100s answers.

To see what actual resolvers you’re using, do this:

# resolvectl
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: foreign

Link 2 (eth0)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 1.1.1.1
DNS Servers: 1.1.1.1
DNS Domain: vander.host

Wrenching back control

To restore your system to a sensible state where you actually have control, you have to follow all these crazy steps:

sudo apt install resolvconf
sudo systemctl enable resolvconf.service
sudo systemctl start resolvconf.service
sudo nano /etc/resolvconf/resolv.conf/head

Add the following two name servers to the head:

nameserver 1.1.1.1
nameserver 8.8.4.4

Restart the service:

sudo systemctl restart resolvconf.service

To check your work:

cat /etc/resolv.conf | grep -v '#'

The above command does an invert match so it will display lines that do not have comments.

What a mess. Well done Ubuntu.

Share this article

1 thought on “Solving weird DNS resolv.conf issues on Ubuntu using the resolvconf service”

Leave a Reply

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

Scroll to Top