Home Computer Networks What is DNS and how does DNS lookup work?

What is DNS and how does DNS lookup work?

DNS(Domain Name System) is a decentralized naming system that converts domain names(such as intmain.co) to its corresponding IP addresses.

Each device connected to the internet has a unique IP address, which is a 32-bit number for example IPv4), and remembering such an IP address is almost impossible. The solution to this problem was using English letters, as we humans beings are good at memorising English words. Hence the concept of Domain Name came into the picture. Each domain name is a combination of English alphabets(generally) and points to an IP address.

To create a mapping between domain names and IP addresses, DNS(Domain Name System) was introduced. Now, whenever a user types a domain name, the DNS translates it into corresponding  IP addresses so browsers can load Internet resources.

Types of DNS Server

1. Root Domain Name Server

Root DNS servers are the first step in the process of resolution of Domain name into IP address. The mapping of a domain name to an IP address is a hierarchical process, and the distribution is done on the basis of DNS zones and Root DNS sits on the top of this hierarchy.

The root-level directly responds to the queries that are for the root zone or refer queries to appropriate TLD nameserver. Generally, most of the queries are contains referring to TLD’s hence Root DNS serves are not involved in name resolution.

There are a total of 13 root DNS around the globe starting with the letter a to m. Refer bottom for further insights.

2. Top-Level Domain (TLD) Server

Top-level domains are first-tier domains available for the use of the general public. They are installed in the Root DNS Server and all the other domains are the part of TLDs. For example, google.com or intmain.co are top-level domains, while nlogn.co.in or google.co.in are secondary level domains.

Top-level domains are divided into two categories:

  1. Generic top-level domains (gTLD) – These are the domains that are not associated with any country. Example – .com, .org, .net, .int, .mil, .edu, .gov
  2. Country-code top-level domains(ccTLD) – These are 2 letter domains established for countries or territories. Example – .in, .uk, .to, .ca, .co, .us etc.
3. Authoritative DNS Server

It is the last stop for a DNS query and returns. It is a nameserver that has the original DNS records such as (A record, MX record, etc.). The request to them reach from resolving name servers and they are the endpoint of any request. Note, they don’t respond to recursive queries.

DNS Lookup

DNS lookup is a process by which an IP address(one of the DNS record) is returned for a domain name by a DNS server. The DNS is lookup is not only limited to returning the IP address, but it can also return all the records associated with a domain name(such as IP, IPv6 address or MX record, etc).


DNS Lookup
DNS Lookup

The request to DNS resolver is a recursive request while all other requests in the above diagram are simple(non-recursive) queries.

The above diagram explains how DNS lookup happens and how DNS routes traffic to a website.

  1. A user opens a web browser, enters intmain.co in the address bar, and presses Enter button.
  2. The request for intmain.co is routed to a DNS resolver, which is typically managed by the user’s Internet service provider.
  3. The DNS resolver forwards the request for intmain.co to a root DNS server.
  4. The DNS resolver again forwards the request for intmain.co, this time to one of the TLD name servers for .in domains. The name server for .in domains responds to the request with the names of the 2 or 4 (depending on the domain owner) name servers that are associated with the intmain.co domain.
  5. The DNS resolver chooses a intmain.co the authoritative name server and forward the request for intmain.co to that name server.
  6. The website’s name server looks in the intmain.co hosted zone for the intmain.co A record, to get the associated value, such as the IP address for a web server,, and returns the IP address to the DNS resolver.
  7. The DNS resolver for the ISP finally has the IP address that the user needs. The resolver returns that value to the web browser. The DNS resolver also caches (stores) the IP address for intmain.co for an amount of time that you specify so that it can respond more quickly the next time someone browses to intmain.co
  8. The web browser sends a request for intmain.co using the IP address that it got from the DNS resolver. This is where the actual content is. For example, a web server running on a Google VM instance that’s configured as a website endpoint.
  9. The web server or other resource at returns the web page for intmain.co to the web browser, and the web browser displays the page.

List of Important DNS record types

  1. A – Returns a 32-bit IP address, commonly used to map a domain name to IP addresses.
  2. AAAA – Returns a host 128-bit IPv6 address.
  3. CNAME – Alias one name to another. The DNS lookup will continue by retrying the lookup with the new name.
  4. TXT – It is used to hold some descriptive text.
  5. MX – Maps Mail Exchange servers to a domain name.
  6. NS – Name server record is used to identify the authoritative DNS server for a domain.

Further Note –

  1. DNS server uses UDP(User Datagram Protocol) to serve requests.
  2. It works at port number 53.
  3. The DNS header size is 8 byte.
  4. DNS query consists of a single UDP request and a reply.
  5. DNS zone transfer is a process of replicating DNS databases across a set of DNS servers. DNS zone transfer uses TCP.
  6. To get the list of all the DNS records for a Domain name try  $ dig any example.com
  7. There are a total of 13 logical Root DNS servers available around the world with from as letter.root-server.org and the letter ranges from a to m.
    1. a.root-servers.org –
    2. b.root-servers.org –
    3. c.root-servers.org –
    4. d.root-servers.org –
    5. e.root-servers.org –
    6. f.root-servers.org –
    7. g.root-servers.org –
    8. h.root-servers.org –
    9. i.root-servers.org –
    10. j.root-servers.org –
    11. k.root-servers.org –
    12. l.root-servers.org –
    13. m.root-servers.org –
  8. ICANN is assigned authority to monitor the operation of the root name server DNS.


Please enter your comment!
Please enter your name here