What is dns and how it works?

3 min readMay 7, 2020

What is DNS ?

Computers talk to each other using IP addresses. Since humans cannot memorize thousands of strings of numbers, we have to use domain names instead of IP addresses.

It is much easier to remember to type sprinkletwinkles.com into your browser than

DNS keeps the record of all domain names and the associated IP addresses. When you type in a URL in your browser, DNS resolves the domain name into an IP address.

DNS cache exists in our browser, computer(which we flush by firing commands ipconfig/flushdns et.c), router e.t.c

How does it work?

Step 1 — Resolve a Domain Name

When you type sprinkletwinkles.com into a browser, in order to load the webpage, your computer asks for the IP address. Computers/mobile/routers do not know in advance where they can find the necessary information, so they try searching through the DNS cache and any available external source.

Step 2 — Search IP Locally

Before going externally, your computer/mobile/router loads the local DNS cache database to see if you already requested the IP for that domain name. Every computer/mobile/router has a temporary cache with the most recent DNS requests and attempts to connect using that.

Step 3 — Contact ISP and its Recursive DNS Server to Resolve a Domain Name

Computer/mobile/router local DNS cache database does not always contain the necessary data to resolve a domain name. In that case, the request goes further to the ISP and its DNS server.

Once it gets a request, the resolver looks in its records to provide the correct IP address. When the necessary information is present in the ISP server’s cached records, the computer gets back the IP and connects to the website. If ISP’s recursive DNS server cannot resolve the domain name, it contacts other DNS servers to provide the information back to you(i.e recursive servers).

Step 4 — Ask Outside DNS Servers to Provide an IP Address


Principal data engineer → Distributed Threat hunting security platform | aws certified solutions architect | gssp-java | Chicago-IL