1

How do I list what dns servers are being searched for things that need to do dns searches?

It doesn't seem like what I have in resolv.conf is being used, So i want to troubleshoot and step one of that would be to have the system print out what servers it is using.

Everything I found so far assumes I have network manager installed, but I do not, and so nmcli or other such commands would not work.

Linux linuxtest 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u2 (2017-06-26) x86_64 GNU/Linux

dr_
  • 29,602

1 Answers1

2

There are plenty of tools for troubleshooting DNS.

  • DIG: IF you just dig a name of a webserver then this tools will show you enough details for the simple troubleshooting you have mentioned. Example,

    arif@arif:~$ dig google.com
    ; <<>> DiG 9.10.3-P4-Ubuntu <<>> google.com
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58212
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 4096
    ;; QUESTION SECTION:
    ;google.com.            IN  A
    
    ;; ANSWER SECTION:
    google.com.     299 IN  A   74.125.200.100
    google.com.     299 IN  A   74.125.200.102
    google.com.     299 IN  A   74.125.200.139
    google.com.     299 IN  A   74.125.200.138
    google.com.     299 IN  A   74.125.200.101
    google.com.     299 IN  A   74.125.200.113
    
    ;; Query time: 287 msec
    ;; SERVER: 192.168.97.54#53(192.168.97.54)
    ;; WHEN: Fri Sep 29 03:39:37 EDT 2017
    ;; MSG SIZE  rcvd: 135
    

    Here you can see in the 3rd line from last that which DNS server you are using to resolve name. In my case it is 192.168.97.54 and as everybode does you are using port 53. In the following example I will show you same thing but but using specific dns server (Dyn-216.146.35.35) and like before you can see that in the ;;SERVER section.

    arif@arif:~$ dig @216.146.35.35 linux.org
    ; <<>> DiG 9.10.3-P4-Ubuntu <<>> @216.146.35.35 linux.org
    ; (1 server found)
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16485
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 1480
    ;; QUESTION SECTION:
    ;linux.org.         IN  A
    
    ;; ANSWER SECTION:
    linux.org.      300 IN  A   104.28.16.26
    linux.org.      300 IN  A   104.28.17.26
    
    ;; Query time: 133 msec
    ;; SERVER: 216.146.35.35#53(216.146.35.35)
    ;; WHEN: Fri Sep 29 03:54:56 EDT 2017
    ;; MSG SIZE  rcvd: 70
    
  • NSLOOKUP: Doing nslookup is the simplest answer in your case. Example:

    arif@arif:~$ nslookup google.com
    Server:     192.168.97.54
    Address:    192.168.97.54#53
    Non-authoritative answer:
    Name:   google.com
    Address: 74.125.200.102
    

    Now doing same thing with the specific DNS server,

    arif@arif:~$ nslookup linux.org 216.146.35.35
    Server:     216.146.35.35
    Address:    216.146.35.35#53
    Non-authoritative answer:
    Name:   linux.org
    Address: 104.28.16.26
    
Thomas
  • 6,362
arif
  • 1,459
  • All of those do not return the list of dns servers it searched, and only return a dns server if they get a result. If they fail to find a result they just specify they couldn't get a result without listing all of the dns servers it attempted – Kyle Spier-Swenson Sep 29 '17 at 18:47
  • The magic that is missing here is the '+trace' command-line option to dig.

    dig +trace [host]

    – Troy Folger Apr 16 '19 at 21:34