3 ms·
The author is using recursive queries to query authoritative servers, such as the "H" root.1 The whole point of querying authoritative servers directly, versus
by 1vuio0pswjnm7 5y ago
The author is using recursive queries to query authoritative servers, such as the "H" root.1 The whole point of querying authoritative servers directly, versus simply querying a third party DNS cache, (one would think) is to use authoritative nameservers because they are authoritative, not recursive (and they are not subject to TTL issues).
Authoritative servers are not supposed to accept recursive queries (RD bit is 1), they will just ignore the RD bit, and caches are not supposed to accept nonrecursive queries (RD bit is 0). Unfortunately one can find people on the internet who use DNS caches to provide "authoritative" answers. Regardless of the intent of the person using such a configuration (e.g., it could be intended to deceive or it could be merely for "convenience"), AFAICT that is not how DNS was intended to be configured.
For example, djbdns' dnscache properly rejects nonrecursive queries. Unfortunately, large public DNS caches run by third parties like 1.1.1.1, 9.9.9.9 or 208.67.222.222 will accept them. By contrast, 8.8.8.8 will not.
1. There is also the issue of using domainnames for nameservers instead of IP addresses. Doing so means the stub resolver has to do recursive queries to find the IP address of the nameserver. Thus the whole process of using nonrecursive "authoritative servers" actually becomes reliant on a recursive cache. For many folks, that means one that is run by a third party. The cache effectively becomes the source of "authority".
Here is how an example of how to find/check nameservers servers using only authoritative servers (no caches) with a stub resolver such as dig/drill/kdig/dnsq/dq:
#!/bin/sh
test $# = 1||exec echo usage: $0 domainname
# which is the fastest stub resolver. for me dig is much slower than the others. test this yourself
# uncomment the stub resolver to use
#DIG="dig +norecurse";
#DIG="drill -ord";
#DIG="kdig +norecurse";
#DNSQ="dnsq";
#DNSQ="dq -a";
if test "$DIG";then
ns=$($DIG $1 @198.41.0.4 ns|tr '\11' '\40'|sed -n '/ NS /{s/.* //;p;q;}');
nsip=$($DIG $ns @198.41.0.4 a|tr '\11' '\40'|sed -n '/ A /{s/.* //;p;q;}');
$DIG $1 @$nsip ns|tr '\11' '\40'|sed -n '/./{/AUTHORITY SECTION/,/^$/{/ NS /{s/.* //;p;};};}';
exit;
fi;
if test "$DNSQ";then
ns=$($DNSQ ns $1 198.41.0.4|sed -n '/ NS /{s/.* //;p;q;}');
nsip=$($DNSQ a $ns 198.41.0.4|sed -n '/ A /{s/.* //;p;q;}');
$DNSQ ns $1 $nsip|sed -n '/^authority:/{/ NS /{s/.* //;p;};}';
else sed -n '/^ *#DIG/p;/^ *#DNSQ/p;/^ *# uncomment/p' $0;
fi
exit;
198.41.0.4 is the address for the "A" root which I have memorised
People on the internet claim it is impractical to memorise IP addresses
I have found this is not true and knowing some of these numbers can be very useful when troubleshooting. YMMV
Another one I have memorised is 192.5.6.30 which is the "A" com/net nameserver
I can usually remember a 199.19.x.x org nameserver, too, such as 199.19.53.1