Introduction to DNS?

Introduction to DNS?

A brief introduction to DNS and its working mechanisms.


In Nepal, in our board examinations, we are not allowed to write our names on the exam paper.

We are given a unique roll number and that is what we enter in our paper.

So, the examiner does not know whose paper he is looking into.

But, after the paper is reviewed, marks assigned and when finally we receive our mark-sheet, it contains both our name and roll number.

What has happened here is the examination control division has mapped the roll number with the correct student name while creating the mark sheet.

DNS(Domain Name System) work in a similar way.

Each device in the network has an unique roll number they are identified with, and they are called ip addresses. And, the devices in the network identify and communicate with each other with the help of ip addresses.

For example, one of the ip addresses of google search engine server is

So, if we need to search anything in google, we could just enter the above ip address in our browser url and boom, we are taken to the google search page.

But, as long as you are not the rain-man, it is pretty difficult to remember the above ip address.

Human beings find it much easier to remember a text than number.

And, remembering is much easier than to remember a random ip address.

But, how will the internet know that should be redirected to

It is where DNS servers come into play.

DNS Infrastructure:

Imagine, a user enters, in his browser.

The browser first checks whether or not the ip for the domain name is present in the browser cache. If yes, it returns the ip.

Otherwise, it will check the OS cache for the ip. If the ip is found, it returns it. Else, the request is forwarded to DNS Infrastructure.

DNS infrastructure has mainly 4 types of servers.

  1. DNS resolver:

    DNS resolver is basically the ISP.

    Here, it is checked whether or not the ip is present in the ISP cache.

    If yes, the ip is returned. Otherwise, the request is forwarded to the DNS Root Server.

  2. Root Server:

    Root servers take the query from DNS resolver, but they have no idea what is the corresponding ip address for the given domain name.

    What they do is check the domain of the query domain name (i.e. .net, .com, .org and so on).

    Based on the domain, it directs the DNS resolver to the correct Top Level Domain Server responsible for .com.

  3. Top Level Domain Server:

    Now, the request reaches the domain server that handles the .com domain in our case.

    But, it too does not know the exact ip address.

    But, it exactly knows which Authoritative Name Server has that information.

    So, it provides the address of the Name Server and bid DNS resolver good luck !

  4. Authoritative Name Server:

    Now, DNS resolver will contact the Name Server as per the address given my TLDS.

    And, the Name Server will look into its data entries and find the appropriate domain name -> Ip mapping.

    Then, it will return the desired IP address.

Then the DNS resolver will return the ip address to the browser, which will turn access the domain with the given ip address.

The below diagram shows the scenarios discussed above.

Fig. How DNS works?

At the end, let me tell you an interesting thing related to caching in DNS.

Try entering nslookup the following command in your terminal.

Did you notice Non-authoritative answer in the output?

It means that the ip address was not returned by one of the Authoritative Servers but was returned from one of the caching layers !!.

Hope you enjoyed the article. If you did, please follow me on LinkedIn for more articles on system design.