You are here

Finding out which DNS servers are currently being used in Linux (Ubuntu)

Submitted by Druss on Tue, 2020-12-08 21:23

So, I've been facing some DNS issues with my Ubuntu box and needed to do some debugging. While I was certain that my router was assigning the Google DNS servers (8.8.8.8 and 8.8.4.4) via DHCP to my machine, I needed to make sure that they were actually being used. Usually, I would be able to tell by looking at the output of /etc/resolv.conf oslt. However what I found in resolv.conf was

nameserver 127.0.0.53
options edns0 trust-ad

Using tools like dig also resulted in the nameserver being listed as 127.0.0.53. Googling around informed me that my Linux box was operating a DNS caching server locally. But how do I go about finding out which server this caching server was querying to resolve domains? Apparently, the answer is by using:

resolvectl status

which outputs a whole host of information including:

Link 2 (enp0s25)
      Current Scopes: DNS   
DefaultRoute setting: yes   
       LLMNR setting: yes   
MulticastDNS setting: no    
  DNSOverTLS setting: no    
      DNSSEC setting: no    
    DNSSEC supported: no    
  Current DNS Server: 8.8.8.8
         DNS Servers: 8.8.8.8
                      8.8.4.4
          DNS Domain: ~.    

IOW, the DNS servers my system was using were the Google servers.

Hope this helps :)

Edit:

Disabling this local caching server can be done on Ubuntu by following the steps outlined here.