DNS: A Descriptive Guide on DNS

Published by Supun Kavinda on


DNS stands for Domain Name System. Because of the numerous options/features of it, it’s easy to get confused. Let’s demystify!

Table of Contents

  1. What is DNS?
  2. How DNS works?
  3. What is DNS Caching?
  4. DNS Records
  5. FAQ

What is DNS?

DNS converts a hostname (example.com) to an IP Address (

When you connect your computer to the internet it gets a unique number that identifies it on the internet. This is called Internet Protocol Address, or IP Address in short. These IP addresses can be in IPv4 ( or more complex IPv6 (2001:0db8:85a3:0000:0000:8a2e:0370:7334) formats.

However, humans are more capable of remembering meaningful (or not) names than numbers. For example, which one is easier for you? facebook.com or When you have multiple websites, it makes it much harder to remember numbers. Therefore, we use names (called hostnames) to access the websites on the internet.

Examples: google.com, facebook.com, wikipedia.com, en.wikipedia.com

After you enter a hostname (example.com) in your web browser, the browser has no idea where the server of example.com is. Then, the browser connects to the Domain Name System (DNS), which translates a hostname to an IP address, to find the actual IP address of the server.

Domain Name System is a large collection of servers and a database that works in a procedure which is called DNS protocol.

A Simple Representation of How DNS Works

How DNS Works?

Even the above image shows it in two steps, the actual Domain Name System includes multiple steps and different types of servers specialized in certain tasks. First, let’s see the types of servers and why they are there.

The Domain Name System mainly comprises of 4 types of servers.

  1. DNS Recursor – A person who is finding a book in a library
  2. Root Nameserver – A corridor in the library
  3. Top-Level Domain (TLD) Nameserver – A rack in that corridor named the book’s category.
  4. Authoritative Nameserver – The book

After we find the book, we can find the IP address of our hostname there. However, this library scene is an analogous situation not identical. Let’s see what each server’s responsibilities are.

Server 1: DNS Recursor

DNS recursive resolver
Source: Cloudflare

The first thing out from your computer but in the Domain Name System is the DNS Recursor (or Resolver). When we request example.com in the browser, the browser needs a way to find the IP address of it. So, it asks for help from the Recursor.

The Recursor is provided by your Internet Service Provider. However, it doesn’t have any idea of the IP address of the given hostname. It will recursively send requests to other servers to find the exact IP.

You have an address of a person abroad and need to find him. First, you go to his country. Then, to his province. Next, you visit his district. After that, to his town. Then, his street. Finally, his house.

The same logic is here. Recursor needs to find the IP (person) of the hostname (address).

  • First, it asks a Root Nameserver and will get the address of the TLD Nameserver.
  • Then, it asks the TLD Nameserver to find out the address of the authoritative nameserver.
  • Finally, it asks the Authoritative Nameserver and grabs the actual IP of the server of the hostname. Yay!

Server 2: Root Nameserver

DNS root nameserver
Source: Cloudflare

There are only 13 Root Nameservers in the world (source) and all 13 are known to all the recursive nameservers. These ones too don’t know what is the IP address of the hostname we are finding. (Shame? No.) It knows one invaluable thing: where the data regarding the hostname’s Top-Level Domain is saved.

For instance, if the hostname is example.com, the root nameserver sends back the address of the Top-Level Nameserver of all the .com domains.

Server 3: TLD Nameserver

DNS TLD nameserver
Source: Cloudflare

A TLD Nameserver maintains the data of all the domains of a specific Top-Level Domain, such as .com, .org, .io, etc. When the Recursor requests the information of example.com, for example, the TLD Nameserver will return the address of the Authoritative Nameserver. (Don’t worry it’s the last step).

Server 4: Authoritative Nameserver

DNS authoritative nameserver
Source: Cloudflare

An Authoritative Nameserver is responsible to maintain information about a single domain. When the Recursor requests example.com’s IP address from its Authoritative Nameserver, it will run DNS Lookup to find the IP address. In this process, it will look for A or CNAME records (More on that later). If found, it returns the IP address of the hostname.

Let’s sum it up…

  • You type example.com on your browser.
  • Your browser requests the IP address from the Recursor (or Resolver)
  • The Recursor sends requests to the following step by step to find the address of the next one.
    • Root Nameserver
    • TLD Nameserver
  • Finally, the request to the Authoritative Nameserver of the domain will return the IP address of the requested hostname to the DNS Recursor to the browser.

Now, your browser will render and display the website! (If the website was found)

What is DNS Caching?

You call your mom every day. It’s much easier when you save her number at the top of your phone’s favorite numbers list rather than searching for it every time you need it. Right?

The concept of DNS caching is similar to that. The meaning of Caching is temporarily saving data in an easily-accessible location to retrieve easily without processing, mainly to improve performances. DNS caching involves the DNS, and it can be done at any of the DNS servers, at the user’s OS or even at the user’s browser. The nearer the cached data to the user’s browser the faster it can be retrieved. (Logical, right?)

Note: NDNS data is only cached for a predefined amount of time which is called TTL (Time To Live).

Example DNS Resolving with Caching:

  • You request example.com from the browser.
  • The browser checks its cache for the DNS data.
    • If found, it terminates the DNS resolving and sends the request directly to the IP address.
    • If not, it asks for it from the DNS Recursor.
  • The DNS Recursor checks its cache for the DNS data of the requested domain.
    • If found, it terminates the DNS resolving and sends the IP address back to the browser without further requests.
    • If not, continues the DNS resolving process…
  • ……

You can understand that the request only reaches the Authoritative server rarely (unless the domain is new).

DNS Records

Have you ever set up your own domain for a website? Then, you must have been confused at this point: DNS Records.

Let’s be practical. Suppose that you just bought your dream domain. The company where you bought the domain will (and must) provide you the facility to change the nameserver address of the domain. By default, they are usually pointed to a nameserver managed by that company itself. However, you can use a custom nameserver or a free service like Cloudflare. This process is called pointing your domain to nameservers. It isn’t a new kind of nameserver but what we learned previously as “Authoritative Nameserver“.

Then, you will get a web-based DNS record manager which is usually called DNS Zone where you can add/remove/edit those records for your newly bought domain.

The details of the domain are saved in these records. It’s like a file stack of an investigation – it contains much information about your domain.

Adding a DNS Record

Once you are in the DNS Zone of your domain, you can add a DNS record with the following data:

  • Type – one of the DNS Record types (below 5 or any other).
  • Host – Use @ for the root domain. Or, use a subdomain like www, blog.
  • Value – Depends on the type.
  • TTL (optional) – Time-to-live. Recommended to use Auto.
  • Priority (only for MX records) – Set the priority (Don’t worry. Your email service will give that).

Types of DNS Records

While there is a bunch of DNS records, here are the most common ones.

Record TypeStands ForDescription
AAddressMap a hostname to IPv4. The value should be an IP address.
AAAAAddressSame as A with the exception of using IPv6.
CNAMECanonical NameMap a hostname to another hostname. If the server doesn’t have a static IP, this can be useful. Commonly used to forward www to @. You can also forward to an external domain (blog to my-blog.herukodns.com)
MXMail ExchangeDirect mail to an email server. You can set priority to choose which one to use first.
TXTTextStore a note/value. Frequently used to verify your website.


Q: Why such a complex process? Can’t we have only one database?
There are more than 0.3 billion domain names registered. Having all of the data and resolving hostnames from one server isn’t practical. Therefore, in 1983, Paul Mockapetris invented the DNS. It’s a type of decentralizing for the ease of data handling and speed.

Q: What is the difference between domain and hostname?
Hostnames: example.com, blog.example.com, shop.example.com. Domain: only example.com. Got it? Learn more here.

Q: Why does it take time to see DNS record changes?
It’s because of DNS caching. Try clearing the DNS cache of your browser and OS. If it doesn’t work yet, I have to say, you have to practice a little patience.

In this article, we discussed what is DNS, how it works, caching, and records. If you have any questions to ask, please comment below. So, if you just bought a domain for your website to create an app or start a blog, now you can confidently set up your Domain Name Server Records and enjoy!

Need a privacy-focused commenting platform for your website?

Subscribe to our Newsletter

We write a lot of blog posts to help you grow your audience on your website. Subscribe to get the best blog posts right into your inbox.