How DNS Works

Domain Name System

A newer version of this article is available in my blog.

In any network, the hosts primarily communicate between each other through IP addresses. For example, if my computer is doing a google search, my computer is actually communicating with the IP address of one of the web servers of However, even if the computer is efficient with numbers, humans on the other hand work better with names. For this reason, the TCP/IP protocol includes the Domain Name System (DNS)  to link between IPs and computer names i.e. hostnames. The DNS is a distributed database of computers that is responsible for resolving hostnames against IP addresses and vice-versa.

Any DNS query involves two parts.
  1. The Resolver: The resolver forms up or initiates the query. The resolver itself does not run as a program. /etc/resolv.conf is an example of a resolver.
  2. Name Server: The Name Server is the service running in the server that responds to the DNS query generated by the resolver i.e. answers to the question of the resolver.

Fully Qualified Domain Name

The fully qulified domain name is the full name of any server. Just like any human needs a full name in the real world, every server on the Internet also need a full name to work. The structure of a FQDN- host.domain.tld. For example, in www.qwe.netwww” is the hostname of the web server, “qwe” is the name of the domain and “net” is the top level domain (TLD). Other examples of TLD are .com, .org, .gov, .mil and so on.

The Root-Servers

As mentioned earlier, the DNS works as a distributed database. If a DNS server does not know the answer to a query, it forwards the query to another server upper in the hierarchy. The query keeps going upwards until it reaches the root. There are 13 root servers responsible for all DNS in the world. The root servers are named as to These root servers continuously keep communicating with each other and update each other about what they know. Here is an interesting article about the root DNS server numbers:

Authoritative Name Servers

The authoritative name servers are servers that are responsible for a domain. For example, if we host the DNS for a domain, then the domain requires at least 2 authoritative DNS servers i.e. &

These two authoritative DNS servers are responsible for any DNS query about the domain and should be able to answer any query regarding this domain. The root servers store only the records for the authoritative name servers for different domains.

How DNS Works

I found this step-by-step image in the web, and thought it's worth sharing. Here is the link to the full article-

How DNS works (Reference)

And now for the step-by-step analysis.

  1. The client initiates a query to find The client sends the query to the DNS server of the ISP. (The DNS Server IP in the client computer is set as the IP address of the DNS Server of the ISP)

  2. The DNS Server of the ISP first checks it's own cache to check whether it already knows the answer. But as the answer is not present, it generates another query. As the TLD of is .ca, so the DNS server queries CIRA to find who is responsible for

  3. The CIRA responds to the ISP by answering the query.

  4. Once the ISP DNS Server knows the authoritative name servers, it contacts the authoritative name servers to find out the IP address for i.e. the IP address of host www in the domain

  5. responds to the ISP DNS Server by answering the query and providing the IP address of the web server i.e. www

  6. The ISP DNS Server stores the answer in it's cache for future use and answers to the client by sending the IP address of the www server.

  7. The client may store the answer to the DNS query in it's own cache for future use. Then the client communicates directly with the www server of domain using the IP address.

  8. The www server responds by sending the index.html page.

Hope this helps. ^_^


  1. This comment has been removed by a blog administrator.

    1. Please do not post commercial advertisements without prior approval. Thank you for your understanding.

    2. This is what I have searched for months. Such a superb description. Thank you very much. you are an asset IT professionals.

    3. Thank you for the feedback. There is a similar article that I had written for I thought you might be interested. I am providing the link for your reference.

    4. Thanks Ustad described very simply so that amateur can understand. Thanks a lot!!


Post a Comment