3

For some reason, my DNS seems to be set to 127.0.0.53. It's not really a problem, since my local (i.e. on my laptop) DNS seems to redirect DNS requests to the default gateway. But I would like it to not go that way. I suppose I must have installed some DNS server at some time in the past...

When I run $ nslookup, default server is always 127.0.0.53.

I found a post suggesting that I set DNSStubListener=no in /etc/systemd/resolved.conf, but this resulted in no DNS requests coming through. I could of course enter my default gateway manually, but then I would have to change it every time I brought my laptop to work.

Any suggestions?

EDIT: Adding the "hosts" line of /etc/nsswitch.conf:

hosts:          files mdns4_minimal [NOTFOUND=return] dns
7
  • 1
    Your DND server is not actually 127.0.0.53. Look at this question on Unix &Linux: unix.stackexchange.com/questions/612416/…
    – Nmath
    Apr 24, 2021 at 16:08
  • 1
    Please add to your post the "hosts" line of /etc/nsswitch.conf ..; Adding the libnss-resolve package alters this and might fix some local name lookups.
    – ubfan1
    Apr 24, 2021 at 16:11
  • 1
    It's working the way it's supposed to. Don't mess with it. Do resolvectl status | grep -i "DNS Serve" to see what DNS Servers that you're actually using.
    – heynnema
    Apr 24, 2021 at 23:29
  • @heynnema: Is this default Ubuntu behavior?
    – OZ1SEJ
    Apr 25, 2021 at 11:05
  • 2
    Yes. Everybody's /etc/resolv.conf shows 127.0.0.53. It's all managed by systemd-resolved. Using my prior command you'll see what real DNS servers it all points to. I see too many people trying to manually edit /etc/resolv.conf (even though it says not to in the file), thinking that they can "fix" an unbroken DNS system.
    – heynnema
    Apr 25, 2021 at 12:41

1 Answer 1

9

The DNS Servers are managed by systemd-resolved, or by dnsmasq (if you have that installed).

If dnsmasq is installed, you must edit /etc/systemd/resolved.conf, else you'll have two DNS mechanisms fighting for port 53, so...

change:

#DNSStubListener=yes

to this:

DNSStubListener=no

/etc/resolv.conf normally contains 127.0.0.53, which is the local address for the local DNS mechanism. Do NOT manually edit this file (it says so right in the file itself).

To view what actual DNS servers are being used, do this...

resolvectl status | grep -i "DNS Serve"

More than likely it'll report 192.168.0.1 (the address of your router, or the DNS servers of your VPN service, if you use a VPN). Your router will probably use your ISP's DNS servers, unless you've manually changed that in your router's admin config page (highly recommended).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.