Search code examples
dnsrootnslookupdigzone

dig +short doesn't work when querying root DNS server?


I've found that if I query a UK root DNS server directly (e.g 195.66.240.130) it provides a result in 2-5ms vs querying a regular DNS server which takes 15-40ms.

However, for some reason the +short option doesn't work when querying 195.66.240.130

Works: dig @8.8.8.8 example.co.uk NS +short

Doesn't work: dig @195.66.240.130 example.co.uk NS +short

Does anyone know why?

If I remove +short then all relevant info is shown but I'm trying to get the output cleanly.


Solution

  • The +short option is to print the ANSWER section from the response which may be empty (in the case of referral answers) as you can see from the example below:

    [vitalie@silver ~]$ dig @195.66.240.130 bbc.co.uk NS
    
    ; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_5.3 <<>> @195.66.240.130 bbc.co.uk NS
    ; (1 server found)
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63811
    ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 4, ADDITIONAL: 4
    
    ;; QUESTION SECTION:
    ;bbc.co.uk.                     IN      NS
    
    ;; AUTHORITY SECTION:
    bbc.co.uk.              172800  IN      NS      ns1.thdo.bbc.co.uk.
    bbc.co.uk.              172800  IN      NS      ns1.rbsov.bbc.co.uk.
    bbc.co.uk.              172800  IN      NS      ns1.thls.bbc.co.uk.
    bbc.co.uk.              172800  IN      NS      ns1.bbc.co.uk.
    
    ;; ADDITIONAL SECTION:
    ns1.bbc.co.uk.          172800  IN      A       132.185.132.21
    ns1.thdo.bbc.co.uk.     172800  IN      A       212.58.224.21
    ns1.thls.bbc.co.uk.     172800  IN      A       132.185.240.21
    ns1.rbsov.bbc.co.uk.    172800  IN      A       212.58.227.48
    
    ;; Query time: 57 msec
    ;; SERVER: 195.66.240.130#53(195.66.240.130)
    ;; WHEN: Wed Dec 22 15:12:29 2010
    ;; MSG SIZE  rcvd: 179