How to find a domain's authoritative nameservers
jvns.ca
jvns.ca
The root will return the list of authoritative nameservers, but each of those authoritative servers may have a different list - and that list may still be used for resolution.
For example, if the root says ns1,ns2.example.com are the nameservers for your domain, but ns1.example.com also lists ns3.example.com as an authoritative server, then resolvers WILL query ns3. If ns3.example.com does not actually have authority for your domain (I.e., a lame delegation), then DNS queries for your domain will fail some percentage of the time.
It is valid (though confusing) to extend the list of authoritative nameservers from what the root says. But they had better all actually BE authoritative.
In my experience, this is one of the more common DNS misconfigurations.
I wish domain registrars warned domain owners about lame delegations - they know owner's email or can show a message in an admin panel.
After that you can remove the server and the name and if it's cached somewhere, it still points to a valid server.
You can also find all current root nameservers by running
dig ns .
Since all domains end with a terminating '.' / are descendants of the DNS root '.', even though browsers obscure it. $ dig
...
;; QUESTION SECTION:
;. IN NS
...Bind doesn't complain about the extra records, but also doesn't return them, even if b.example.com is hosted on the same bind instance. (Which is technically correct, but sometimes confusing).
DNS propagation is a lie!
The answer, for .(com|net|org) at least, appears to be that the registrar makes an [EPP][^1] request on your behalf. The protocol is documented in IETF std69 -- specifically [RFC5731][^2].
What I'm not clear on is whether other methods are still in common use. I'm also curious what the process looked like before EPP. If someone else here knows, I'd be interested in learning.
[1]: https://en.wikipedia.org/wiki/Extensible_Provisioning_Protoc... [2]: https://www.rfc-editor.org/rfc/rfc5731.txt
ccTLDs[3] are free to chose their own provisioning process / protocols; some use EPP, some don't.
[0] https://en.wikipedia.org/wiki/Generic_top-level_domain (although some domains listed as gTLDs by Wikipedia would be better categorised as uTLDs) [1] https://en.wikipedia.org/wiki/Sponsored_top-level_domain [2] https://www.igoldrush.com/domain-guide/domain-name-basics/tl... [3] https://en.wikipedia.org/wiki/Country_code_top-level_domain
Although, now that I think of it, you do need to be mindful even today. You could stills misconfigure them, but it's unlike it will be due to forgotten/missing records. Which I think is the most common issue, because people don't understand enough how DNS works to know those are needed
I constantly get indications that dig is this really powerful tool, but I must say I always find its output baffling. Granted I'm not expert on DNS but I know the basics and its still pretty damn arcane. I usually can decipher it in the end (assuming nothing too weird is going on) but I can't shake the feeling that my understanding is being obstructed by the tool here.
Try reading this, with just the tool output, A and NS records, like the old days:
dig +trace jvns.ca | egrep ";|IN\s+A|IN\s+NS\s"
I'm gonna fathom a guess that this is likely because you aren't aware that tha output returned by dig is (by default) valid BIND zonefile format/syntax, and/or you aren't very familiar with the BIND zonefile format/syntax itself.
Regardless, though, dig has a number of query options you might like to use that will suppress much of the (redundant and/or unwanted) output that's shown by default, such as "+noadditional", "+noauthority", "+nocmd", "+nocomments", "+noquestion", "+norrcomments", or "+nostats". You can even put all of those those (on a single line) in a "$HOME/.digrc" file and they'll be used automatically everytime you run "dig". See dig(1) for details.
Alternatively, you might find it easier to simply get into the habit of using (only) the "+short" query option everytime you run "dig" (or put that in .digrc). Just at the output of these queries, for example:
$ dig +short ns example.com
$ dig +short a google.com
The output quite possibly contains exactly what you want to know and nothing more -- including, especially, all of the extraneous output that often just gets in the way and leaves you constantly baffled!The reason why public recursive resolvers are unreliable when records change is because they cache answers according to the TTL, recursively. If you always use the authoritative servers to walk the query, though, you effectively sidestep this, since authoritative servers are the ones that actually store the records.
(In the past it was also common for operating systems to default to caching DNS records, but even though it is definitely beneficial for performance, I think a lot of them have stopped, for the sake of making things less confusing. You can potentially improve your web browsing experience by installing a caching DNS server locally to your machine or network!)
The bottom of the article, with 'other ways' got me thinking that another way to get what is very probably the correct answer is asking a bunch of other DNS servers what they think the correct answer is.
Using dug (https://github.com/unfrl/dug) like: dug -q NS jvns.ca I was able to see that 32 of the 37 servers it tried got an NS record with art.ns.cloudflare.com This also shows you how well(ish) the answer is propagated
https://www.cloudflare.com/learning/dns/what-is-anycast-dns/
https://labs.ripe.net/author/emileaben/dns-root-server-trans...
> dig -x some_ip_address
This will usually give you the right answer, but it might be an old cached version."
Is that really ever a problem? Who changes authoritative nameservers for a domain? This is by far the easiest way and the whole blog post could have just been six lines long.
> I’m writing this because if you made a DNS update and it didn’t work, there are 2 options: Your authoritative nameserver doesn’t have the correct record. Your authoritative nameserver does have the correct record, but an old record is cached and you need to wait for the cache to expire
Anyone who has just bought a domain, or anyone who is changing their hosting to a new provider.
It also relies on the registry operating an accurate and reliable whois service. I would not count on that from ccTLDs.
Edit: registrar’s whois
The whole point of the blog posts is to explain the problem in detail, not getting some quick task done for the sake of getting it done. Just like https://jvns.ca/blog/2021/12/04/how-to-use-dig/ isn't "Use man dig" but an in-depth explanations of the features and usage.
What I'm wondering is how whois data is cached. Anyone have a reference on how that works in practice?
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