2

I'm trying to fetch DNS data without any local or ISP resolvers using the DIG tool.

For example I try google.nl

I start at a rootserver (d.root-servers.net):

dig @199.7.91.13 google.nl

Then I take the registry from this:

;; ADDITIONAL SECTION: ns1.dns.nl. 172800 IN A 193.176.144.5

dig @193.176.144.5 google.nl

;; AUTHORITY SECTION: google.nl. 3600 IN NS ns2.google.com.

Now here is where I get stuck. Because google.nl uses the nameservers of google.com, it won't send any glue records.

Should I then dig from root again for google.com?

dig @199.7.91.13 google.com

;; ADDITIONAL SECTION: a.gtld-servers.net. 172800 IN A 192.5.6.30

dig @192.5.6.30 google.com

Now in this case, google.com is using it's own nameservers so glue records are provided in the ;; ADDITIONAL SECTION:, but it is possible this domain would be using different nameservers.

Then you'd need to fetch those nameservers, I feel like you could go on like that in an endless way untill you are being served an actual IP address instead of a reference to a nameserver.

Is that how it works, or is there a shorter way to the IP address of a nameserver (so to get the IP address of ns2.google.com from google.nl?

  • It's simpler, yet more complicated than that. The hierarchy is actually meant to be preserved and you should not bypass it by polling higher level DNS servers unless you have to. – Julie Pelletier Aug 14 '16 at 21:44
  • Remember that your resolver may have cached information already, so it might already know the A records for ns2.google.com (for example). – Stephen Harris Aug 14 '16 at 21:49
  • I'm building a little tool to check domain configuration, so I need the most current information. Now in this case another hierarchical query for the nameservers may be needed, as it can be possible to work on multiple domains. I think a list of the TLD nameservers could be locally cached, that would at least save the root queries. – Arie Aug 14 '16 at 22:02
2

That is the way it works. Not ideal, to be sure. Resolvers will hit hardcoded limit if recursion goes for too long... See for example https://cybermashup.com/2014/09/23/how-dns-kills-the-internet/

1
$ host -t ns google.nl|cut -d" " -f4|xargs -l1 host
ns2.google.com has address 216.239.34.10
ns1.google.com has address 216.239.32.10
ns4.google.com has address 216.239.38.10
ns3.google.com has address 216.239.36.10
  • This uses the local resolver or configured resolver, I want to get the IP-address from the hierarchy top to bottom. – Arie Aug 14 '16 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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