A Dialog Explaining DNS

by bryanwoodsmall

Here is a dialog that attempts to explain how DNS works. I put this together for a challenge in the Webcraft 101 class on P2PU.com. I think a dialog form is a natural way to explain DNS. I already knew a little about DNS, and used Wikipedia for further information. The disclaimer is that I am not sure that this dialog is completely correct. I would appreciate it if you let me know about any errors.

Here goes:

“I have to find out what name servers my web hosting company uses, so I can put them in this form for my domain name registrar. Something about DNS. What is DNS anyway, and what are Name Servers?”

“DNS stands for Domain Name System. It is a system that looks up domain names, and translates them into IP addresses.”

“Okay, I think I kind of know what an IP address is. It is the unique number applied to each computer on the internet, right?”

“That is pretty much it. Sometimes there can actually be more than one computer sharing an IP address, but we don’t need to get into that. Other resources on the internet also have IP addresses. It is really more like an ID number than an address. It is the way you contact a computer – kind of like a phone number is the way you contact a person.”

“Okay…So the IP address is like a phone number, the domain name is like a name, and DNS is like a phone book – it looks up the number that goes with the name.”

“Yes, but it is more complicated than that. It is hierarchical and distributed. It works like this: When you type in a domain name into a browser, your system (probably your router) sends out a request to particular computer (that it is configured to use) to ‘start the ball rolling’ so to speak, to find out the ip address of the computer that corresponds to the domain name you entered.”

“You say ‘start the ball rolling’. Why don’t we just have a big computer, ran by Google or the government, that does the lookup. Why do they make it complicated?”

“It is way too many requests for one computer to handle. It would not be efficient. Also, it would not be reliable. They make it both efficient and reliable by spreading out the work among many computers.”

“Okay, so that first computer that my router contacts, what does it do?”

“It just looks at the last part of the domain name (.com, for example), and sends back to your router the ip address of the server that manages the lookup for all requests for domains ending in .com”

“That computer must be a monster. There are a lot domain names that end with .com”

“I’m sure it is a monster. However, after we go over the basic system, I’ll tell you about a shortcut that actually ends up handling most requests.”

“Okay, but save that for later. I’m having a hard enough time following this already. So my router gets back the address of the computer that manages the lookup for the .com domains, and then my router sends the request to that computer, I guess. You say ‘manages the lookup’, so I’m guessing that this computer doesn’t look it up either. It just sends back another address right?”

“You are definitely catching on.”

“I guess the word ‘hierarchical’ kind of clued me in. So it gives my router another ip address, and my router will send the request to that new address. It is sounding a bit like a wild goose chase.”

“Well, your router is actually closing in on the information it needs. The address it gets back from the server managing the .coms is the address of the name server for the domain you typed in. For example, if you typed in khanacademy.com, the address your router gets back is the address of the name server for khanacademy.com. So when your router sends the request to that address, it is getting closer.”

“Name server — we finally got to that. So what exactly is a name server? I’m thinking it is the one that is finally going to give my router the ip address of the domain name I typed in.

“You are right again. The name server is designated as a computer that can resolve that particular name. There will typically be more than one, in case one is not working, or can’t be contacted. So once your router gets the address of the correct name server, it can send one last request. If all goes well, the name server will give your router the address it was looking for. Then it is done with DNS, and can use that IP address to contact the computer that corresponds to the domain name you typed in.”

“So how does the computer that manages the .com requests know what name server has the IP address of the particular domain name that I typed in?”

“Well, I guess someone has to tell that computer that information. The one that communicates that to the computer managing the .com requests is the registrar for that domain name.”

“Oh…so that is why I have to type in the name servers into that form for my domain registrar. Part of registering the domain name for me is that they tell the .com server which name server can resolve my domain name into an ip address. That way the .com computer can send the ip address of that name server to computers that want to go to my website.”

“I think you’ve got it.”

“Well, kind of. I’m sure it is more complicated than that, though.”

“You’re right, but we have discussed the essence of how it works. Now about that shortcut I mentioned earlier: Whenever your router (or other ‘DNS resolver’ on the local network) finds an IP address by the above sequence, wouldn’t it make sense for your router to remember that for awhile (in a cache), in case you or someone else on your local network wants to look at the same website later?”

“Yeah, I guess that would make sense.”

“It would indeed. And in fact, that is what your router does. Also, sometimes when your router sends a request, the computer that answers doesn’t just send back the next address it gets, but instead keeps sending out the requests itself, until it finds the final ip address, then sends that to your router. An intermediate computer that does that also goes ahead and remembers that info for awhile, in case it gets a similar request later from someone else. Then it can quickly send the final ip address right back, instead of doing the cycle of requests to resolve the name.”

“Wow, I can see how that could save a lot of time.”

“Yes, so actually most requests get resolved that way. But whenever a computer does not have the information in its cache, it will go through the long process.”

Advertisements