If you know a thing or two about domain names, you might have seen the letters DNS floating around. Whether in discussion, or in the settings of your website or domain provider, DNS (or, Domain Name System) is an integral part of how the internet functions.
What does DNS stand for?
DNS stands for Domain Name System. In short, DNS is a system which translates domain names – the memorable, human-friendly addresses we type into the search bar – to computer-friendly, numerical (or alpha-numerical) IP addresses.
DNS is often referred to as a phone book for the internet, as it links a domain’s IP to the domain being searched for – much like linking a phone number to a person’s name. In simple terms, each time a request is made for a specific domain, the DNS looks it up and tells the browser which IP that domain name points to. We dissect domain names in much more detail in our post What is a Domain Name?
But it isn’t quite as simple as that, mainly due to the sheer number of IP addresses and domain names out there.
In 1983, Paul Mockapetris invented the Domain Name System. Prior to this, the internet was still in its infancy, and primarily used in an academic capacity. It was essentially limited by the scope of human memory – each separate web page was defined by a 32-bit long IPv4 address, such as 172.16.254.1. Therefore, remembering more than a few addresses was difficult.
Once DNS was implemented, it opened up the internet in a way that was just not possible before. Some of you might be able to rattle off a couple of IP addresses, but chances are you can remember far more domain names – especially those for the most popular websites.
The four types of DNS servers
Before we get into the nitty gritty of how a DNS works, there are four main DNS servers you should be aware of. These servers are vital to the smooth running of the DNS.
Recursive DNS server: This DNS server is responsible for all client machine queries. The recursive DNS server receives these queries via sources such as web browsers, and makes requests on behalf of the user.
Root name server: One of these servers can be expected to answer any queries about domain names directed to the root zone. The root name server will then point these queries in the right direction, usually to the TLD name server.
TLD name server: Depending on which TLD, or top-level domain, has been queried, the appropriate TLD name server will respond. For example if the domain name uses a .co.uk TLD, this is the name server that will be used.
Authoritative DNS server: This server acts as the final locator of the IP address, and if it has access to the requested address, it will ping this over to the recursive DNS.
Now, you might be wondering how all of these components work in unison, let us explain.
How does DNS work?
The system goes through a number of steps to reach the objective of translating a domain to its IP address. Here’s what it does:
Step 1: The user requests the information
This happens whenever you click a link or enter a URL into your browser, among other things. It’s the browser which makes this initial request. First, it will check its local DNS cache. If you’ve visited a site before recently, its translated address will be stored in the cache so it can be easily found again.
If the address is not in the cache, meaning it hasn’t been visited before or not in a while, the request moves to the next step.
Step 2: The request is sent to recursive DNS servers
The request will be sent up the chain to recursive DNS servers (also known as resolvers). These are provided by the user’s internet service provider, but can also be operated by third party providers such as Google. These have their own caches, and as other users use the same resolvers, popular websites are likely to be stored in this cache.
If the address is found in the recursive DNS servers, the request will be returned to the browser and it will end there. But if it isn’t, it goes even further afield.
Step 3: The root name server directs queries to TLD name servers
The recursive server will query a root name server, which essentially is able to answer questions about domain names. This type of server won’t store any IP addresses itself, but acts as a switchboard – they direct the query to the TLD name servers.
In this case, TLD stands for top-level domain – also known as a domain extension. A TLD name server will contain information for a specific TLD, such as .com, .co.uk, or .net. For instance, if example(dot)com was what the user queried, the request would be directed to a TLD name server for .com domains.
The TLD name server can then direct the request on to the server which stores the IP address for example.com specifically.
Step 4: The TLD server sends the query to authoritative DNS servers
The TLD name server will look at the “example” part of the example.com request, and direct the query to the relevant authoritative DNS server. These are what hold the actual “translations” to the original request. The recursive server – the second step in the process – will retrieve the result of the query and store it in its own cache. If another query comes through for the same domain, the recursive server can now serve the request without having to go through the query process again.
Step 5: Receiving the result
The recursive server will return the answer of the query back to the computer that asked it. In the case of a normal user browsing on their personal computer, the operating system of the computer will then let the browser know what IP address the domain points to – which it can then load.
While there are lots of steps to this process, you wouldn’t notice as you use the internet – as it takes milliseconds to complete each request.
The difference between authoritative and recursive DNS servers
Although they are both types of DNS servers, the authoritative and recursive DNS servers have two different functions. The purpose of an authoritative DNS server is to store DNS records, while the recursive DNS server acts on behalf of the user’s query. Working in conjunction, the recursive DNS server will require information from the authoritative DNS server in order to enact the user's end goal.
Three types of DNS queries
There are three versions of DNS queries: recursive, iterative and non-recursive.
Recursive query: A recursive query deals with DNS client requests via the DNS server. This server will send the appropriate response to the client machine.
Iterative query: In an iterative query, the DNS server will offer the best possible response to the DNS client. However, if there is no response, the DNS client will be provided with a referral address to make the query to.
Non-recursive query: A non-recursive query occurs when a DNS client requests a record from the DNS server and the answer is sent back immediately. No other steps or queries are needed.
What is DNS caching?
DNS caching, or DNS cache, enables clients or servers to store their DNS records locally for future use. Ultimately this avoids re-searching for past DNS queries by storing them temporarily, and the records can be retrieved quicker.