Skip to content
NetworkTechGuy

How to stop & disable stub DNS resolver

By Nenad Karlovcec1 min read

If you're running Ubuntu Linux 20.04 (probably older versions as well), you may have noticed that your DNS server is set to 127.0.0.53. I believe that this is called a local stub DNS.
The issue is that sometimes, when running local services, your stub DNS resolver will actually be the first one to respond, not your actual DNS server (internal or external).
I'm not a sysadmin, but I've found a way to resolve (no pun intended) the issue for me:

BASH=
systemctl stop systemd-resolved
systemctl disable systemd-resolved

Now you can edit /etc/resolv.conf and add your own nameservers into it. If the file is unwritable or it doesn't exist, you should be able to add it yourself.
See for yourself:

Plain Text
# service systemd-resolved disable
# service systemd-resolved stop
# ping www.google.com
ping: www.google.com: Temporary failure in name resolution
# nano /etc/resolv.conf

Added the nameserver at the bottom of the file:

Plain Text
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 10.4.0.2  # my local DNS server

Retried the ping:

Plain Text
# ping www.google.com   
PING www.google.com (172.217.0.228) 56(84) bytes of data.
64 bytes from yyz10s03-in-f4.1e100.net (172.217.0.228): icmp_seq=1 ttl=116 time=1.11 ms
64 bytes from yyz10s03-in-f4.1e100.net (172.217.0.228): icmp_seq=2 ttl=116 time=1.26 ms

Comments (0)

No comments yet. Be the first to comment.

Leave a comment

Never shown. A confirmation link is sent to it.

Plain text. A comment with more than one link waits for review.

Privacy: your name and comment are shown once published. Your e-mail address is never shown or passed on; it is used for the confirmation link and to recognise your later comments, and is deleted when you have no comments left here. Comments that are never confirmed are deleted after 7 days. Confirming sets a cookie in this browser so that it does not ask again.