If you search the Internet for “What is DNS?”, you’ll see that it’s a way of “Translating human-readable domain names to machine-readable IP addresses”. This then raises another question, “What does all that mean?”
In this guide, I’ll try to demystify what DNS actually is and roughly how it works. Think of it as a way of “Translating computer jargon readable by technicians into an everyday language readable by the rest of us”.
- Why Do We Need DNS?
- The Domain Name System (DNS).
- How Does DNS Work?
- The DNS Lookup.
- Root Server, Top Level Domain Server & Name Server.
- What Is DNS?
Why Do We Need DNS?
Every computer connected to the Internet has an IP address (Internet Protocol address). An IP address is a long string of numbers, rather like a telephone number.
The IP address identifies each individual computer on the ‘net. In the same way that a telephone number identifies each phone.
The problem is that we humans, whilst rather good at remembering names, are poor at remembering numbers, particularly long numbers.
Scrolling through your phone book, you’ll identify individuals by their names, not by their phone numbers.
When you tap on a contact to call or text, you’re tapping on someone’s name. But your phone loads up that person’s phone number. Essentially, what it’s doing is converting the name you tapped into a number, a phone number.
Website IP Addresses.
The same is true when you’re searching the Internet for a website. Imagine searching Google for Amazon, Netflix, Facebook etc, and seeing just the IP addresses of those websites.
Finding Your Own IP Address.
The Domain Name System (DNS).
DNS is the Internet’s way of doing exactly the same for website names as your phone does for your contact’s names. It converts website names into IP addresses.
In order for your computer to connect to a website, it needs to know what that website’s IP address is.
DNS servers simply store data that matches a domain name (website name) to its corresponding IP address.
So that’s the simplified version of “What is DNS?”. Below we’ve got a more in-depth view of how the Domain Name System works.
How Does DNS Work?
As you can imagine, many millions of websites are on the Internet. Storing, searching and then delivering the IP addresses for an individual website is an enormous task. But that is precisely what has to happen in order for us to be able to connect to any given site.
Not only that but there are millions, possibly billions of us trying to get that information, all at the same time.
So the process is broken down into different stages and the data (the DNS records) is split between different types of DNS servers.
The DNS Lookup.
The whole process is known as a DNS lookup. It all begins when you click on a website name in the search results or from your bookmarks/favourites list.
If you’ve visited that website recently, then your computer may already know the IP address. Both your web browser (Chrome, Edge, Brave etc) and the operating system (eg Windows) maintain a DNS cache of website names (domain names) and their respective IP addresses.
If your browser is given the IP address from your own computer cache, then that’s all it needs. The browser can then send a request for whichever webpage you’ve clicked on.
But if the IP address isn’t in your local cache (on your own computer), then your browser sends a request to your ISP’s (Internet Service Provider) DNS server for the IP address. This first DNS server is called the DNS Recursor or DNS Resolver.
The DNS Recursor/Resolver.
It’s the DNS Recursor/Resolver that is now responsible for finding out what the IP address is for the given website that you’ve requested. The resolver is going to act as a kind of middleman, or agent, on your behalf.
Firstly, the resolver will check its own DNS cache to see if it already has the information.
If you’re trying to reach a well-known website, such as Facebook, Amazon, Google etc, the chances are pretty good that someone else, who is also using the same ISP as you, has already visited that site today.
If that’s the case, then all the work of resolving the query has already been done and is cached. The recursor/resolver will simply send the IP address back to your computer allowing your PC to send a request for the relevant webpage.
If the resolver doesn’t have the information (the IP address), then it will begin sending out a series of queries to other DNS servers in an attempt to find the IP address of the website you’re trying to reach.
Root Server, Top Level Domain Server & Name Server.
DNS servers are arranged in a pyramid-style hierarchy. At the top are the Root Servers. These are followed by the Top Level Domain Servers (TLD Servers) and finally, there are the Authoritative Name Servers (Name Servers).
A website address (domain name) is associated with a particular DNS hosting provider’s name servers, which are responsible for resolving the IP address of that website.
If the resolver can’t resolve the query (it doesn’t know the IP address of the website you’re trying to get to), then it will need to track down the authoritative name server (or name server) that holds the information.
The recursor/resolver will contact the root server first.
The root server will check the very end of the website address, the .com .uk .fr .de etc. That’s known as the Top Level Domain (TLD). Each Top Level Domain has its own DNS servers.
For example, if the website you’re trying to reach ends in .com, then the root server will send the resolver the IP address for the TLD server that holds the .com data.
The resolver will cache the data for future use and then contact the relevant top level domain server.
Top Level Domain Server (TLD).
The recursor/resolver requests the IP address from the TLD servers for the IP address of the website you want to connect to.
The TLD servers don’t actually hold that information. Instead, the TLD server will reply to the request with a list of IP addresses for the relevant name servers for that website.
The resolver caches the data for future use and then contacts the relevant name server.
The Authoritative Name Server (Name Server).
Finally, the resolver has reached a DNS server that actually knows the IP address of the website you’re trying to reach.
The name server replies to the resolver with all the information it requires, which is both cached and returned to your computer. Your PC will, in turn, cache the IP address and then send out a request for the web page that you clicked on.
What Is DNS?
The easiest way to think of DNS is like the Internet’s phone book. It’s a way of trying to keep track of all the websites that appear.
Although many of the larger websites do have static IPs, many millions of smaller sites don’t. IP addresses are constantly changing and the Domain Name System has to be able to keep up.
Should You Change Your DNS Server?
On the Internet, there are many sites and articles suggesting that you can speed up your connection speed by changing your DNS provider. And sometimes I get asked by a client if they should.
The answer is, well, maybe.
DNS is only responsible for finding the IP address of a website that you haven’t got already cached on your local computer. It can’t speed up your Internet connection and it can’t make a website respond faster to requests.
However, switching to a recursor/resolver that’s got a larger cache and is able to handle all the requests that are coming into it, then yes, you might see a difference.