What is a DNS?
A domain name system (DNS) is a naming database. In this database, internet domain names are identified and translated into Internet Protocol (IP) addresses. The DNS maps the name people use to locate a website to the IP address that a computer uses to locate that website, creating a connection between the domain name and the IP address itself.
For example, if someone were to search ‘example.com’ on a web browser, a DNS for that web browser maps the connection between the ‘example.com’ domain name and the corresponding IP address. While the domain name is a series of words in a standard format – like ‘example.com’ – the IP address is a string of numbers, typically looking more like this:
93.184.216.34
Most internet-based activities like browsing the web are reliant on the work of a DNS to efficiently provide information and connect the user to the remote hosts they’re searching. Throughout the internet, DNS mapping is distributed in a hierarchy of authority.
This means that official organizations such as governments and universities, as well as access providers and enterprises often have their own assigned ranges of IP address for their various sites, as well as an assigned domain name related to their purpose, for example ‘gov.uk’ is the domain name for the government website in the United Kingdom.
In addition to this, these types of organisations usually run DNS servers of their own to manage the mapping required for these domain names and IP addresses. Most Uniform Resource Locators (URLs) are built around the domain name of the web server that takes client requests. This use of unique identifiers makes them essential for locating resources online in a fast and efficient manner.
How does a DNS work?
In its simplest form, DNS servers convert URLs and domain names into IP addresses that computers can understand and utilise. The DNS acts as a translator, taking the information input by a user on a browser and translating it into information that the machine itself can use to find a webpage on the internet.
This process of translation and lookup is called DNS resolution.
Let’s break down how a DNS resolution works, step by step:
- The user enters a web address or domain name into a browser.
- The browser sends a message, called a recursive DNS query, to the network to find out which IP or network address corresponds to the domain name given.
- The query goes to a recursive DNS server, which is also called a recursive resolver, and is usually managed by the internet service provider (ISP). If the recursive resolver has the address, it will return the address to the user, and the webpage will load.
- If the recursive DNS server does not have an answer, it will query a series of other servers in the following order: DNS root name servers, top-level domain (TLD) name servers and authoritative name servers.
- The three server types work together and continue redirecting until they retrieve a DNS record that contains the queried IP address. It sends this information to the recursive DNS server, and the webpage the user is looking for loads. DNS root name servers and TLD servers primarily redirect queries and rarely provide the resolution themselves.
- The recursive server stores, or caches, the A record for the domain name – this is the information it received when corresponding with the DNS root name servers and TLD servers. This caching means that the IP address corresponding to the domain name has been stored and the next time that domain name request is received, the DNS recursive server can respond directly to the user instead of querying other servers.
- If the query reaches the authoritative server and it cannot find the information, it returns an error message.
The entire process, including querying the various servers when needed, takes fractions of a second and is usually imperceptible to the user entirely.
When DNS servers communicate, they are capable of answering questions from both inside and outside their own domains. When a server receives a request from outside the domain for information about a name or address inside the domain, it provides the authoritative answer.
When a server gets a request from within its domain for a name or address outside that domain, it forwards the request to another server, usually one managed by its ISP. This is the process that has been described and is imperceptibly fast.
How is a DNS Structured?
Firstly, let’s break down a domain name into its various parts. You might think of a website’s domain name as consisting of one entity, but in fact it consists of multiple parts. The domain name is usually contained in a URL, which can be used to describe the entire website name.
The parts within a website’s domain name are called labels, and the hierarchy of these labels reads from right to left, with each section denoting a specific subdivision.
The top-level domain (TLD) appears after the period in the domain name, with examples being: .com, .co.uk, .org, and .edu as common occurrences. Sometimes, these TLDs are used to denote a country code such as ‘.co.uk’ and ‘.uk’ for United Kingdom, ‘.eu’ for the European Union, ‘.us’ for the United States or ‘.ca’ for Canada. Other times, they denote the purpose of the organisation, such as ‘.edu’ being used for education institutes like universities.
Each label in a URL is a subdomain of the label to its right. For example, in the URL ‘www.aoitcloud.com’, the term ‘aoitcloud’ is a subdomain of ‘.com’, and ‘www.’ is a subdomain of ‘aoitcloud’, allowing the URL hierarchy to build as it goes.
At the extremes, there can be up to 127 levels of subdomains, and each label within that can have up to 63 characters. The total domain character length possible is 253 characters, although it would be rare to find. Other rules of URLs include not starting or ending labels with hyphens – such as ‘www-‘ – and not having a fully numeric TLD name, like ‘www.example.123’.
The Internet Engineering Task Force (IETF) has specified rules about implementing domain names in Request for Comments (RFC) 1035.
The DNS utilises all of the information contained in the domain name to catalogue and connect the user to the appropriate IP address.
DNS Server Types
There are several server types involved in completing a DNS resolution. The following list describes the four name servers in the order a query passes through them. They provide the domain name being sought or referrals to other name servers further down the list.
- Recursive Server
The recursive server takes DNS queries from an application, such as a web browser. It’s the first resource the user accesses and either provides the answer to the query – if it has it cached – or accesses the next-level server if it doesn’t. This server may go through several iterations of querying before returning an answer to the client. All of these iterations take fractions of seconds.
- Root Name Server
This server is the first place the recursive server sends a query if it doesn’t have the answer cached. The root name server is an index of all the servers that will have the information being queried. These servers are overseen by the Internet Corporation for Assigned Names and Numbers, specifically a branch of ICANN called the Internet Assigned Numbers Authority.
- TLD Server
The root server directs the query based on the top-level domain (this is the ‘.uk’, ‘.com’, ‘.edu’ or ‘.org’ etc within the URL). This is a more specific part of the querying.
- Authoritative Name Server
The authoritative name server is the final checkpoint for the DNS query. These servers know everything about a given domain and deal with the subdomain part of the domain name. These servers contain DNS resource records with specific information about a domain, such as the A record. They return the necessary record to the recursive server to send back to the client and cache it closer to the client for future lookups, ultimately making future searches more efficient.
A simple way of looking at the process is as though it was a request between the recursive server and the authoritative name server. The recursive server asks on behalf of the user, and the authoritative name server provides the necessary answer. The root name server and TLD server handle the query as it travels between the recursive server and the proper authority.
Types of DNS queries
The following types of DNS queries are the main ones that take place at different points in the DNS resolution.
- Recursive DNS queries
These are those that take place between the recursive server and the client/user. The answer provided is either the full name resolution or an error message saying that the name cannot be found. Recursive queries end in either the appropriate answer or an error message.
- Iterative DNS queries
These take place between the recursive resolver, which is a local DNS server, and the nonlocal name servers, like the root, TLD and authoritative name servers. Iterative queries do not demand a name resolution; the name servers may instead respond with a referral. The root server refers the recursive server to the TLD, which refers it to an authoritative server. The authoritative server provides the domain name to the recursive server if it has it. Iterative queries resolve in either an answer or a referral. This is shown in the description above of the chain-of-command for DNS server types.
- Nonrecursive queries
These queries are those for which the recursive resolver already knows where to get the answer. The answer is either cached on the recursive server or the recursive server knows to skip the root and TLD servers and go directly to a specific authoritative server. It is nonrecursive because there is no need for any more queries. Nonrecursive queries resolve in the answer. If a recursive resolver has cached an IP address from a previous session and serves that address upon the next request, that is considered a nonrecursive query.
In the basic DNS process, a client makes a recursive query to the recursive resolver, which then makes a series of iterative queries that result in referrals to the next iterative query.
Eventually, the query goes to the authoritative server, which, if the recursive resolver knows it will find the answer there, makes a nonrecursive query to retrieve it. The information is then stored, or cached, on the recursive resolver so that a nonrecursive query can retrieve it in the future.
How Does a DNS Increase Web Performance?
Hopefully, you understand the process of DNS servers well enough by this point to understand that their ability to cache A records, consisting of IP addresses, makes them excellent for improving the efficiency and effectiveness of a variety of web performances. Caching promotes efficiency, enabling servers to respond quickly the next time a request for the same IP address comes in.
For example, if everyone in an office needs to access the same training video on a particular website on the same day, the local DNS server would only have to resolve the name once, and then it can serve all the other requests out of its cache. The length of time the record is held, also known as the time to live (TTL), is set by administrators and depends on various factors. Longer time periods decrease the load on servers, and shorter ones ensure the most accurate responses.
DNS Caching
The goal of DNS caching is to reduce the time it takes to get an answer to a DNS query. Caching enables DNS to store previous answers to queries closer to clients and get that same information to them faster the next time it is queried.
DNS data can be cached in a number of places. Some common ones include the following:
- Browser
Most browsers, like Apple Safari, Google Chrome and Mozilla Firefox, cache DNS data by default for a set amount of time. The browser is the first cache that gets checked when a DNS request gets made, before the request leaves the machine for a local DNS resolver server.
- Operating System (OS)
Many OSs have built-in DNS resolvers called stub resolvers that cache DNS data and handle queries before they are sent to an external server. The OS is usually queried after the browser or other querying application.
- Recursive Resolver
The answer to a DNS query can also be cached on the DNS recursive resolver. Resolvers may have some of the records necessary to return a response and be able to skip some steps in the DNS resolution process. For example, if the resolver has A records but not NS records, the resolver can skip the root server and query the TLD server directly.





