github icon
github icon

shafikshaon / Understanding DNS: A Step-by-Step Guide

Created Fri, 07 Apr 2023 14:40:09 +0600 Modified Wed, 17 Jul 2024 08:21:53 +0000
646 Words 4 min


The Domain Name System (DNS) plays a crucial role in how we access information online. It translates human-readable domain names into IP addresses that computers can understand. This blog post will provide an easy-to-understand, step-by-step guide on DNS, how it works, and the different components involved in the process.

What is DNS?

DNS is like the phonebook of the Internet, translating domain names into IP addresses. It allows humans to access websites using domain names, like or, while computers interact using IP addresses. Each device connected to the Internet has a unique IP address, and DNS servers help users avoid memorizing these addresses.

How does DNS work?

DNS resolution involves converting a hostname (e.g., into a computer-friendly IP address (e.g., The process consists of multiple hardware components and requires no interaction from the user’s computer apart from the initial request.

DNS Servers Involved in Loading a Webpage

There are four DNS servers involved in loading a webpage:

a. DNS Recursor: It receives queries from client machines and is responsible for making additional requests to satisfy the client’s DNS query.

b. Root Nameserver: It’s the first step in translating human-readable hostnames into IP addresses and serves as a reference to other, more specific locations.

c. TLD Nameserver: This server is the next step in the search for a specific IP address and hosts the last portion of a hostname (e.g., “com” in

d. Authoritative Nameserver: This is the final stop in the nameserver query and returns the IP address for the requested hostname back to the DNS Recursor.

Difference Between an Authoritative DNS Server and a Recursive DNS Resolver

The recursive resolver is at the beginning of the DNS query, while the authoritative nameserver is at the end. Recursive resolvers handle requests from clients and track down the DNS record, while authoritative DNS servers hold and are responsible for DNS resource records.

Steps in a DNS Lookup

A typical DNS lookup consists of the following eight steps:

  1. User types a domain name into a web browser, and the query is received by a DNS recursive resolver.
  2. The resolver queries a DNS root nameserver.
  3. The root server responds with the address of a Top Level Domain (TLD) DNS server.
  4. The resolver requests the .com TLD.
  5. The TLD server responds with the IP address of the domain’s nameserver.
  6. The recursive resolver sends a query to the domain’s nameserver.
  7. The IP address for the domain is returned to the resolver from the nameserver.
  8. The DNS resolver responds to the web browser with the IP address of the domain requested.

What is a DNS Resolver?

A DNS resolver is responsible for dealing with the client’s initial request and starting the sequence of queries that ultimately leads to a URL being translated into the necessary IP address.

Types of DNS Queries

There are three types of DNS queries: recursive, iterative, and non-recursive. These queries help optimize the DNS resolution process and reduce the distance traveled during the lookup.

What is DNS Caching? Where Does It Occur?

DNS caching temporarily stores data to improve performance and reliability for data requests. It can occur in various locations, such as the browser, operating system, and DNS infrastructure, each of which stores DNS records for a set amount of time determined by a time-to-live (TTL).


The Domain Name System (DNS) is a vital component of the Internet, translating human-readable domain names into IP addresses and allowing web browsers to access online resources. By understanding the various components of the DNS infrastructure, such as recursive resolvers and authoritative nameservers, as well as the different types of DNS queries and caching, you can better appreciate the complex process behind each DNS lookup. The performance and reliability of the DNS infrastructure have a significant impact on our online experience, making it an essential topic to understand for anyone navigating the digital world.

Commit ID: c5d17ea267e3042c327c7fa17af122cf4c614f7b ∙ View Commit on GitHub