What Is DNS and How Does It Work?
At this point in time, life without the internet seems unimaginable; especially during COVID-19 lockdown.
Even before the pandemic, billions of people accessed the internet every single day for everything from work and education, to online shopping and virtual communication.
Despite spending several hours browsing the web each and every day, the vast majority of users don’t understand how the internet and the World Wide Web (WWW) works.
One of the most important instruments on the internet is the Domain Name System (DNS). In short, DNS is a protocol used to map human-readable domain names to Internet Protocol (IP) addresses.
Its purpose is vital as it is used to convert domain names such as “hostingcanada.org” to an IP address (18.104.22.168) that can be used by computers to identify each other on the network.
In this comprehensive guide, we will be discussing how a DNS works, what it is used for and the different types of DNS servers.
A Brief History of the DNS
Back when the internet was much smaller than it is today, users had to remember the specific IP address of each site. As the internet grew, it became increasingly difficult to remember the IP address of every site, so we had to come up with a solution.
In the early ’80s, an American computer scientist named Paul V. Mockapetris developed a system that automatically translated computer-readable information (IP address) into human-readable information (domain name).
Serving as the backbone of the internet, Mockapetris created what is now known as the “DNS”.
Despite just how crucial this system was and still is, very few people know that DNS exists or how it works. Today, we are about to change that.
What Is DNS and How Does It Work?
Before we discuss the main uses and building blocks of the DNS, you must first understand how it works. As we have previously noted, the Domain Name System is a protocol that allows you to connect to websites on the internet.
It does this by mapping human-readable domain names to IP addresses that can be used by computers, but where does this information come from?
In simple terms, DNS records are essentially a set of instructions that contain the IP address of a domain name. They also contain a range of commands for how the DNS server should respond to a request.
DNS records are stored on nameservers across the globe that, rather than storing every single domain in existence, store only the locations of the Top-Level Domains (TLD).
A TLD is the last section of a domain name, such as “.co.uk” and “.com”. Every single top-level domain has a group of nameservers used to store information including who is authoritative for storing the records for that specific domain.
Generally, the authoritative nameserver is either the DNS registrar (such as GoDaddy) or the DNS provider. We’ll explain what authoritative DNS servers are later in this guide.
Types of DNS Queries
In the section below, we have provided a little more information regarding how DNS works.
A DNS client provides a hostname and the DNS Resolver provides an answer, responding with either a requested resource record or an error message. One of the most common errors is DNS Server not responding.
A DNS client provides a hostname and the DNS resolver answers the query. If the resolver does not have the appropriate DNS records in its cache, it sends the DNS client to the authoritative name server or the DNS root server.
This arises when a DNS resolver returns a DNS record since it already stores the record in local cache.
How Does the DNS Translate Domain Names to IP Addresses?
DNS servers don’t exist merely because it’s easier for humans to remember domain names than a long string of numbers. They exist because computers also need the IP address of a domain to access websites on the internet.
The process of a DNS translating a domain name to an IP address is called DNS resolution, here’s how it works:
- ☑️ When you type a domain name into your browser, such as www.hostingcanada.org
- ☑️ Your web browser sends a message to the network asking for assistance. This message is known as a query
- ☑️ Your device (computer) communicates with a recursive resolver to locate the cached IP address
- ☑️ If the recursive resolver cannot find the IP addres
- ☑️ The machine messages the DNS root name servers for the domain name’s IP address
- ☑️ The DNS root name servers then direct your ISP through the domain name space (DNS hierarchy)
- ☑️ By referring your ISP’s recursive resolver to the required TLD name servers. It does this by scanning the TLD
- ☑️ Every TLD in the DNS has its very own group of nameservers
- ☑️ Recursive resolver requests the IP address from each nameserver
- ☑️ They are then referred to a more appropriate DNS
- ☑️ At this stage in the process, the DNS servers are examining the Second Level Domains (SLD)
- ☑️ Then, your internet service provider askes the referred DNS name servers for the relevant IP address
- ☑️ Your ISP’s recursive resolver retrieves the domain’s most basic DNS record
- ☑️ The A record for www.hostingcanada.org is retrieved from the authoritative name servers
- ☑️ It then stores the record in its cache for future use
- ☑️ Finally, your internet service providers recursive DNS servers deliver the A record to your device. Now, your computer can read the record containing all of the information regarding the domain name. It then forwards the IP address to your browser so that you can enter the site.
The Four Main DNS Building Blocks
The DNS infrastructure is comprised of four main building blocks:
A DNS resolver — also known as a recursive resolver — is a server on the internet that is designed to receive DNS queries from a web browser.
Whenever you connect to a site using a human-readable domain name such as www.hostingcanada.org, your computer needs to find the IP address for that website.
To do this, your computer communicates with the DNS resolver which then receives the domain name and locates the IP address for that specific hostname.
The DNS resolver that your computer contacted is typically chosen by your Internet Service Provider, though it can also be operated by the local network, a WiFi network or a mobile carrier. If you want to change your DNS server address, you can do this in network settings.
Do you happen to use Chrome as your primary browser? Head to the Change your DNS server section of the Help Centre for more information on how to change your DNS server address on the Google Home app and Google Wifi app.
DNS Root Server
The DNS root server, also known as the root server, is a crucial part of the internet. Root servers are responsible for translating domain names into IP addresses and are therefore responsible for the main functionality of the DNS.
Rather than handling the entire domain name, a DNS root server only handles the generic top-level domain (gTLD), such as “.ca” and “.com”.
If register www.example.ca with SiteGround, the provider must tell the DNS root name server responsible for handing “.ca” that it is in charge of that domain.
When an internet user types “www.example.com” into the address bar, their internet service provider’s DNS servers must check which DNS root name servers to “talk to”. In this instance, the ISP’s DNS server asks the “.co.uk” root server where it needs to go to find “www.example.com”.
At this moment in time, there are 13 root servers globally that must work together. These are indicated by letters A – M and are operated by organisations including NASA Ames Research Center and the U.S. Army Research Lab.
Top-Level Domain Name Server
As the name suggests, the top-level domain name server is the highest level of domain names in the hierarchical Domain Name System (DNS root zone). The TLD name server provides the IP address of an authoritative name server. In other words, it provides the IP address of the last section of a domain name following the final dot.
In the table below, we have listed several different types of top-level domains you will have likely come across when browsing the web.
- ☑️ .com Commercial
- ☑️ .org Organisation
- ☑️ .net Network
- ☑️ .int Internet Assigned Numbers Authority (limited to entities endorsed by a treaty between two nations).
- ☑️ .edu Education
- ☑️ .gov General Services Administration (via Verisign)
- ☑️ .mil United States Department of Defense
- ☑️ .arpa Address and Routing Parameter Area (infrastructure top-level domain)
In the early development of the internet, this list only consisted of .com, .org, .net, .int, .edu, .gov and .mil.
Authoritative Name Server
The authoritative name server is a server that responds to DNS queries regarding domain names installed in its configuration system. There are currently two types of authoritative name servers:
- ☑️ Master server: The primary name server that stores the original copy of all zone records.
- ☑️ Slave server (secondary name server): A replica of the master server used to improve DNS zone availability and share DNS server load in the event that the primary (master) server fails.
Types of DNS Servers: Authoritative DNS Servers vs Recursive DNS Servers
Although we have briefly explained what an authoritative name server is, let’s take a look at the difference between authoritative vs recursive DNS servers.
Authoritative name servers store DNS record information such as the domain registrar and the DNS hosting provider.
As recursive servers fittingly have to recurse up the DNS hierarchy (or DNS tree) to reach the name servers authorised to store the domain’s records, they are often classed as the middleman between authoritative servers and end-users.
Typically referred to as the resolving server, recursive name servers can store caches of DNS record information. As this is the case, most queries for the most well-known domains on the internet never reach the authoritative name servers.
The recursive servers will recurse up the domain name space to find the authoritative server for the domain’s records if they are not already cached.
If you’ve read through the other posts on our website, you probably already know how web hosting works. The question is: do you know about DNS hosting?
Without DNS, we’d have to memorise the IP address of every single website we want to visit on the WWW. Many of the web hosting providers we have reviewed in the past offer free DNS, including Namecheap — a provider that offers free DNS for those whose registrars do not provide DNS hosting with domain registration.
Depending on the DNS hosting provider you opt for, you may even be more protected from potential DDoS (Distributed Denial of Services) attacks given that they have more reliable DNS redundancy.