Have you every wondered how a computer figures out what computer to talk to when you type in the URL in a browser? Or maybe when you are setting up your email server?
Not even a little bit?
Oh… Well what if I told you that its one of the most important parts of how the internet works and it’s critical for keeping your business online? When things go wrong it’s good to know how things work and more importantly who is responsible.
Besides – I think it’s really quite interesting how we manage to get it all to work. You might too.
A bit of background – What is DNS?
When a computer is connected to a network is doesn’t actually use the names we type into the browser to communicate. Everything on a network communicates using an address that’s usually made up of a bunch of numbers like this “184.108.40.206”. It’s quite similar to how phone numbers work. To be able to talk to someone you need to know their number.
So quick side question… how many phone numbers do you know without having to look it up?? Humans are terrible at remembering numbers, unless of course you are a national memory champion, or something. So we, as humans, rely on a phone book to keep all those phone numbers stored against peoples or businesses names.
The Domain Name System (DNS) is just like a phone book but for computers!
So all we need is a phone book like the old school white pages but for computers, right?
The white pages?
It’s a huge book with white pages (obviously) that lists everyone’s phone number that lives in your town… They used to deliver them to every house… You can still get one delivered if you want it.
You’re happy using the internet for that?
Now what was I was saying?
How many addresses are there?
So our current network numbering system (called IPV4 if you want to sound really nerdy) has over 4 billion possible addresses in it.
Can you imagine how big a book would need to be to store that many names and numbers?
Even storing that much information digitally would require a massive file. It just not possible for everyone to have that information on their devices. And that’s before we even start thinking about the fact that these names and numbers are constantly changing.
So the solution is that we split the list of names and numbers up and get lots of different computers to store a little bit each. In computer speak we call this a distributed system.
Looking up DNS can be slow.
Looking these names up over the network can be a bit… s l o w. Especially when you realise that most standard webpages require hundreds of calls different servers, which are all done by name.
To help speed things up we use a cache. This is a local copy of all of the names and numbers that we have looked up in the past. The first time you request a page, say ‘itgeniq.com‘ your computer will check if it has already looked this up before and if so it uses that answer. If it doesn’t then it will ask another computer if they know the answer.
You don’t have long to live
But remember how I said that these names and numbers are often changing? If your computer has already looked up the address for a computer but you then decide to change that address how will I ever get the new one? Well we decide when we add things into a Domain Name System how long it can be cached for before the computer must check again.
We call this the Time To Live (TTL) and we set it in the number of seconds. So if I look up “google.com” and get an answer and it’s TTL is 5 minutes then I can only use the local version for 5 minutes before my computer has to ask another server again.
If you have ever tried to move a website from one server to another then this explains why it’s possible for people on different computers to get the old one vs the new one.
How do we know what other DNS server to ask?
So if you’ve made it this far you are doing well. We have one last piece of the puzzle to get the whole picture and you may be asking this already.
Who is this other computer that I keep talking about?
Do we just randomly start asking other computers? NO! That’s like randomly stopping someone on the street and asking if they know your brother’s phone number.
This other computer that I mention is another DNS server that your network configuration tells you to ask. On your home computer this will typically be your internet providers servers. In most cases they actually act a bit like your local computer and just cache the names and numbers it’s looked up. It’s just that they are doing it for everyone on their network. Of course they know who to ask when they don’t know the answer.
What we really need to know is who is the ultimate DNS server (called the authoritative server) that has the final say in what that name resolves to.
The way a DNS server will go about this is by starting at the last part of your domain eg “.au” for an Australian domain and getting the server that can answer the next bit up, for example “.com.au” or “.edu.au”. It keeps going until it gets the IP address it needs for the name.
Yeah. I think might be a bit tricky to understand. Let’s work through an example.
An example of how DNS lookup works
Let’s pretend I am a DNS server and I need to find out the IP address for “www.google.com.au”. Here’s how the conversations might look if I was texting instead of using the DNS protocols.
Note that we already have the number for all of the ROOT servers stored. So we ask them first.
Next we send a message to the new server we just found out about.
Now we know who the google DNS server is we send them a message.
And there we have it. That’s how a DNS server figures out the IP address for a domain on the internet. Well… A simplified version.
Checking the records for our domain.
Once last thing that is handy to know… A Domain Registrar is the company that is responsible for your domain, usually this is who you bought the domain from. They are the ones responsible for keeping the top level DNS servers up to date with your Authoritative Name Servers.
Don’t remember who that was? Well luckily we can find this out using a handy little tool called whois.
This shows us that the registrar is Synergy Wholesale. The other cool thing that whois tells us is the current DNS servers that are authoritative for our domain.
This shows us that today if you want to know any of the addresses for anything that ends in ‘.intgeniq.com’ you have to ask the name servers listed.
Summing it all up
Here’s a summary of the things I covered:
- So Domain Name Servers are just like the phone books we use for storing people’s phone numbers against their names.
- Due to the size and how often it is changed these DNS servers are distributed.
- We cache entries to help make DNS lookups faster
- Cache entries are only allowed to live a short while so that we can ensure changes to DNS eventually get picked up.
- Each domain has a nominated DNS that is the source of all truth for that domain (deligated DNS).
- You can find the Current Registrar and Authoritative name servers by using whois.
So even though you don’t have to understand this for your systems to work I hope this knowledge will reduce the confusion you face when something goes wrong with your domain names not going where you expect!
Having troubles with your domain names not resolving properly? Then you can reach out to us by filling in the form below.
Want to get notified when we publish other articles like this? Then give us your deets and we’ll notify you by email.