How are the NS records resolved

dns-zonedomain-namedomain-name-systemnameservernetworking

Note: I'm aware of glue records and that DNS servers use them only in case the ns server domain is the same as the domain for which you sent the query.

Now my question was: Say you have example.com which has ns1.example.org (a different domain than example.com) as its NS record. At some point, the resolver will need to also resolve and find the IP address for ns1.example.org. My question is, HOW does it do that (without a glue record)?

My guess is that it starts the process over again, first going to the root DNS, then to the .org DNS, then it reaches the nameservers for example.org…but wait, do nameservers have nameservers? If yes, then this would end up in a big endless loop, because now you'll need to find the NS records for example.org and go there etc.

My point is, these IP addresses for the name servers MUST be stored somewhere. I've heard people say that glue records are only used if say you have example.com and its NS servers are ns1.example.com, same domain. If it's a different domain, then I've read there's a resolution of that domain in order to find the IP…but this implies that nameservers like ns1.example.org have their own nameservers which really makes no sense.

Best Answer

Delegation to a name server in a different domain really doesn't change much - it's just making the resolver do more legwork.

In the example you provide, the example.org domain must be functional for the example.com name to successfully resolve - why wouldn't it have its own functioning name servers, or glue records?

The infinite-loop failure scenario you seem to be imagining would only come into play if you created an impossible delegation loop, like if you tried to delegate ns1.example.org back to a name server under example.com.