I have cached the response received from dig command using a c code , and I want to use authorities list to call directly for finding the ip ,avoiding a part of dns lookup , but I have no idea how to do that.
;; AUTHORITY SECTION:
gogole.com. 172748 IN NS ns2.google.com.
gogole.com. 172748 IN NS ns3.google.com.
gogole.com. 172748 IN NS ns1.google.com.
gogole.com. 172748 IN NS ns4.google.com.
;; ADDITIONAL SECTION:
ns2.google.com. 104506 IN A 216.239.34.10
ns1.google.com. 345589 IN A 216.239.32.10
ns3.google.com. 104506 IN A 216.239.36.10
ns4.google.com. 104506 IN A 216.239.38.10
For example this is for google , I want to interrogate ns1.google.com next time to have the ip. Can anyone help me ? Thanks.
the Linux dig
command's syntax is described in its manual page
man dig
This will tell you that:
A typical invocation of dig looks like:
dig @server name type
where:
server
is the name or IP address of the name server to query.
This can be an IPv4 address in dotted-decimal notation
or an IPv6 address in colon-delimited notation (...)
So, once you have the authoritative name server's name or IP address you want to query, e.g. ns1.google.com as shown in your example, you just add @ns1.google.com
to your dig command-line to obtain the response from that server.
for instance, like this:
dig @ns1.google.com google.com A
This is useful to check the TTL set by the owner of the zone for that DNS record, and to troubleshoot DNS cache problems.