Skip to main content

Command Palette

Search for a command to run...

How DNS Resolution Works

Updated
2 min readView as Markdown

What is Domain Name System (DNS)?

It serves as the pathway to navigate through the internet — the map of the internet.

getting us from domains ( like google.com ) to exact machines using IPs where the actual data lives, is the work of DNS.

Resolution - working of DNS

When we search for a website in our browser, that’s where DNS plays it’s role (think of it as telling us who should I talk to…. next).

Request starts from Root servers, TLD servers, Authoritative DNS server, lastly to an IP and all the way till browser (browser fetches using IP). This is where the resolution occurs, moving continuously one to next in fraction of a second.

Root servers: Majorly 13 root servers exist, these act like directory of internet and there exist 1600+ implementations of these servers (basically copies of the root servers to handle traffic efficiently).

Top level domain (TLD) servers: holds tld info. like .com, .org etc. , help us identify who owns particular domain ( that a /b person owns this .com) and where its authoritative dns server is located.

Authoritative DNS server : finally gives the IP address to the machine where the actual data lives.

Querying dns through cli

The dig command, is a network tool for querying domain name system (DNS) servers. It helps diagnose DNS-related problems.

dig [server] [name] [type]
  • [server] (optional). The IP address or hostname of the DNS server to query.

  • [name]. The domain name to query. This is the DNS resource record about which you want information.

  • [type] (optional). The DNS record type to query, including A, MX, and NS. dig will query an A record if no type is specified by default.

dig . NS :

. - root, NS - record , will give the NS records of root

dig com NS :

returns the name servers authoritative for all .com domains

dig google.com NS :

returns NS records of google.com

.        → Root NS        → knows TLDs
.com     → TLD NS         → knows domains under .com
google.com → Authoritative NS → knows real DNS records