Nick Jackson

Developer of the interwebs, advocate for technology for good and awesome, enjoyer of fine ales and good food.


Get Your Domain On

17 Apr 2014

Wondering why I'm blogging about this? Read more about my quest for badges!

The web is full of acronyms, thrown about by people like me as shorthand for the myriad of different systems which are involved in getting a web page out of the mind of the developer and into your web browser. One of these acronyms is DNS, three little letters which pretty much underpin the entire internet as you know it. They stand for "Domain Name System", and I'm going to explain what DNS is, why it's important and how it works.

Before I can leap into DNS, I need to explain a bit about how the Internet works. If you've watched a 'hacker' movie before, you will likely have seen a scene in which someone sits at a computer, bangs a few keys and spits out a screen like this one:

A screenshot of my terminal, showing an IP address amid gibberish.

In the middle of all the nonsense you will spot a series of numbers separated by dots. This is an IP address, in this case 185.31.16.133. Exactly how IP addresses are made up, how they are handed out and how they work behind the scenes is a very, very long topic to try and tackle so I won't bother; instead, just think of an IP address like a phone number. Each computer on the Internet has one (or — more accurately — has access to one, a bit like how more than one person can share a landline number).

Every time your web browser wants to get part of a website, it needs to use the IP address to contact the relevant computer and get hold of the content. However, you'll note that when you visited my blog today you didn't type 185.31.16.133 into your address bar (and it won't be showing that now, take a look). Instead you typed nickjackson.me, or followed a link to the same thing. Clearly then there is some magic happening in the background to turn one into the other, and this is where DNS steps in.

Back in the good old days when people still had to go outside, telephones didn't have built-in phonebooks. Instead the only way to find out someone's phone number was to actually go and ask them — and this is exactly how the Internet worked. To communicate with another computer you had to know their particular sequence of numbers, and the human brain really sucks at remembering sequences of numbers. It turned out that the telephone industry had also run into this problem, and had come up with an ingenious solution.

The 118 men.

Directory enquiries, represented here by the 118 118 men, meant that armed with nothing more than a name you could call up directory enquiries and in return find out the number of the person you wanted to speak to. The Domain Name Service, or DNS for short, is the Internet's version of a directory enquiry service; letting a computer look up a name and find out the number. Instead of having to remember that Google was at 173.194.34.100 and P2PU was at 69.164.208.57 you could instead remember google.com and p2pu.org.


That covers the what and the why of DNS. The exact details of how are quite long-winded, but I'll summarise what's going on here so you've got a more complete idea of what's going on.

  1. To start with, you type an address into your browser. In this case I'll use my own website nickjackson.me as an example.
  2. Your browser has a look at its own internal directory to see if it already knows the number for nickjackson.me. This is the equivalent of keeping a phonebook yourself, it has recently used numbers in for a quick lookup.
  3. If your browser can't find the number, it decides to ask someone else. At this point DNS kicks in — when your computer connects to the Internet part of what's sent to it by the ISP is a reference to your ISP's own DNS service, a bit like your telephone company giving you a card advertising their own directory enquiries number. Your computer gets in touch with your ISP's DNS and basically goes "Hi, do you know the number for nickjackson.me?"
  4. Your ISP's DNS service will check its own directory, which is a bit bigger than your computer's and will include far more names and numbers. Your ISP might know the number for a popular website already, in which case it can send it back to your computer, or it might not.
  5. If your ISP doesn't know the number for the address, it will set out to find it. This starts with a global service, looked after by the people at IANA. Your ISP's DNS service will get in touch with the servers at the very root of DNS, and ask "Hi, do you know the number for nickjackson.me?"
  6. The root servers will normally respond with something along the lines of "No, I don't know the number, but I do know the number of someone who can tell you more about the .me part of the address. Try 89.188.44.44."
  7. This process continues, with the ISP's DNS system trying progressively more accurate directories until eventually one will respond with "Yes, I know the number for nickjackson.me. it's 185.31.16.133."
  8. Your ISP's DNS system will record this fact locally to save time the next time someone asks for it, and will reply to your computer with the number.
  9. Your computer finally gets in touch with the number it's been given, and says "Hi, can you send me the content for nickjackson.me."
  10. You get to enjoy the website.

And lo, the DNS system is explained in 10 easy steps.


comments powered by Disqus