0

when I perform a dig lookup to look for dns record for a domain name, server A gives a non empty dns record, but server B gives nothing. why? is there a more consistent approach?
server A

# dig cubagob.cu

; > DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.1 > cubagob.cu
;; global options: +cmd
;; Got answer:

;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;cubagob.cu.            IN  A

;; Query time: 266 msec
;; SERVER: 69.64.66.11#53(69.64.66.11)
;; WHEN: Mon Feb 16 17:18:11 2015
;; MSG SIZE  rcvd: 28

server B

dig cubagob.cu

; > DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.1 > cubagob.cu
;; global options: +cmd
;; Got answer:

;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;cubagob.cu.            IN  A

;; AUTHORITY SECTION:
cu.         2037    IN  SOA ns.ceniai.net.cu. cu-tech.ceniai.inf.cu. 2015021600 3600 1800 604800 3600

;; Query time: 161 msec
;; SERVER: 4.2.2.1#53(4.2.2.1)
;; WHEN: Mon Feb 16 17:18:29 2015
;; MSG SIZE  rcvd: 97
  • Is there any particular reason why you omitted the line containing ->>HEADER<<-? Status codes are usually very pertinent when it comes to asking DNS questions. – Andrew B Feb 17 '15 at 1:37
1

Those are both empty responses with zero answers. (literally, both say ANSWER: 0) The only difference is whether those servers are providing you the AUTHORITY section as a courtesy.

If you want a consistent output, you should either use +short (for answers only) or disable all output settings with +noall and selectively enable what you want to see. That said, shell scripting against the output returned by dig leaves much to be desired. If you need to precisely extract data from reply packets, it's recommended that you use your favorite scripting/programming language and a library suited to the task.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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