john
john

Reputation: 741

DNS second-level domain lookup

How does DNS second-level domain lookup work? For example, in a url web.example.com, the top-level domain is .com, and the second level domain is .example. Based on my understanding, after we find a server for the top-level domain, if this top-level server does not actually have a record for the second-level domain, we query a different top-level server. How does DNS decide which next top-level domain server to query? Are there a lot of top-level domain servers in the world (since there are so many second-level names available)? Since there are so many second-level names, how long could this process potentially take?

This is described on wikipedia: http://en.wikipedia.org/wiki/Domain_Name_System#Address_resolution_mechanism, but this section does not explain how to efficiently find the top-level server with the second-level domain info.

The point of my question is how does DNS efficiently search millions/billions of second-level domains.

Upvotes: 2

Views: 2626

Answers (1)

Celada
Celada

Reputation: 22261

DNS second- (and third-, and fourth-) level domain lookup works exactly the same way first-level domain lookup works.

The description you present in the question is wrong. For example, "if this top-level server does not actually have a record for the second-level domain, we query a different top-level server" is wrong. If one of the servers for a domain does not have a record for a subdomain one level down, that's the end of the search: the subdomain does not exist.

A full description of how DNS resolution works is outside the scope of a SO answer, but in a nutshell:

Starting from the root servers, each DNS server either gives an answer to the question or a referral to another server. Assuming a query for web.example.com, the root servers will give you a referral to the gTLD servers for com.. You will then go query one of those servers. It will give you a referral to the nameservers for example.com. You will now go query one of those servers. It will probably give you an answer (either an error like NXDOMAIN (no such domain) or some records). It could also give you a referral if the subdomain web.example.com has been further delegated to some other servers...

Upvotes: 2

Related Questions