Ubuntu – DNS system is failing to resolve domain names occasionally

dnsnetworking

I'm running Xubuntu…

$ cat /etc/issue
Ubuntu 17.04

$ uname -a
Linux intrepid 4.10.0-33-generic #37-Ubuntu SMP Fri Aug 11 10:55:28 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

…and connecting through wireless network.

However, the DNS system is acting weird and it fails to resolve domain names occasionally.

When I'm trying to resolve some domain name manually it gives me the following error:

$ nslookup google.com
Server:     127.0.0.53
Address:    127.0.0.53#53

** server can't find google.com: REFUSED

Here's the list of all DNS servers configured on my computer:

$ nmcli device show wlp3s0 | grep IP4.DNS
IP4.DNS[1]:                             192.168.1.1
IP4.DNS[2]:                             8.8.4.4
IP4.DNS[3]:                             8.8.8.8

But, when I try to resolve the domain name and tell it to use my router as a DNS server directly (which should be used automatically in the first place) it works flawlessly:

$ nslookup google.com - 192.168.1.1
Server:     192.168.1.1
Address:    192.168.1.1#53

Non-authoritative answer:
Name:   google.com
Address: 173.194.122.238
…

Why does it fail to resolve the domain names? What server is it trying to use by default?

My resolve.conf is looking like this:

$ cat /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.53

Any hints would be highly appreciated, thanks!


And here's the output of $ systemd-resolve --status. The interface I'm using is wlp3s0.

Best Answer

i did what @jringoot suggested in his comment:
mv /etc/resolv.conf /etc/resolv.conf_orig
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
which basically copies the original resolv.conf file and creates another one.

I examined it and it showed it was still using router dns.
so then I opened the file
vim /etc/resolv.conf
and edited the nameserver from the router dns to 1.1.1.1 (CloudFlare DNS)
i.e. fill it with: nameserver 1.1.1.1

when i do a check using
nslookup google.com
it now shows it is using my specified DNS:
nslookup google.com
Server: 1.1.1.1
Address: 1.1.1.1#53

Non-authoritative answer:
Name: google.com
Address: 172.217.160.14

Related Question