how the hell do dns server requests work?

235 views

how the hell do dns server requests work?

In: 1

5 Answers

Anonymous 0 Comments

DNS is a great big hierarchy of names, but processed right to left with the “top” of the hierarchy as the right-most part of the name. Every DNS server remembers whatever details it knows from previous requests identifying which servers own which names – or partial names – and knows where to send requests. Even if it doesn’t know who owns www.reddit.com, it knows who can point it in the right direction.

Even if it knows nothing yet, DNS servers ship with the “root” DNS servers pre-loaded. Their names are `a.root-servers.net` through `m.root-servers.net` and their IP addresses are included with the software. When all else fails, you can ask these servers and they can at least get the process started.

With all that said, let’s look at the actual steps involved. When you ask a DNS server for www.reddit.com, if it already knows the answer because someone else asked it recently, you get that copy. If not, it will ask the DNS server for `reddit.com` for the answer, if it knows who that is. If not, it will ask the `com` server who own it, if it knows who that is. If it doesn’t, it’s off to those root servers to ask. You’ll get information about the `com` servers who will be able to tell you who owns `reddit.com` who will be able to tell you what the IP address for `www.reddit.com` actually is. At each step the responses received are saved so that future queries can be sped up.

For the average user, however, this is all hidden. Your internet provider will have given you some DNS servers they own who do all this work for you. From your own computer’s standpoint, you just ask for `www.reddit.com` to one of these DNS servers and the answer comes straight back. This is a good thing because all the customers of that ISP will take advantage of the lookup work those DNS servers have done on their own so far and re-use the saved results.

There is the subtlety that there are 2 major types of DNS servers: those that do lookups like this while saving results for a certain amount of time (hours, maybe a day) and those that hold actual answers responding to the first type of server. The latter has the proper responses in its own database and doesn’t answer any queries unless the answer is in said database. It has the authority to say “that name does not exist” because it knows “anything matching *`.reddit.com` is in my database” and a request came in for something at reddit.com, but wasn’t in its database.

You are viewing 1 out of 5 answers, click here to view all answers.