DNS: The Web’s Secret Engine 🌐


Introduction
Have you ever wondered how typing “www.example.com” intp your browser’s address bar instantly takes you to the right website? 🌍 It’s all thanks to something called DNS – the Domain Name System.
In this blog, we’ll break down DNS in a simple way, show you the types of DNS records, explain how the DNS hierarchy works, and give you a clear understanding of this hidden hero of the internet.
Let’s get started!
DNS - Domain Name System
Imagine trying to remember the phone number of every person you want to contact. That would be a nightmare, right? 📱 Instead, you use names (like “Mom” or “Best Friend”) to make calling easier. DNS is similar — it matches easy-to-remember domain names like “www.example.com“ with the actual numeric addresses (IP addresses) that computers use to find each other.
DNS is a hierarchical, decentralized naming system used to find the correct place (ip address) of any hosted website over the internet. It store ip address for all the domain names.
DNS acts as the “phonebook” of the internet, allowing users to access websites using simple domain names instead of remembering numeric IP addresses, enabling smooth and efficient navigation of the web.
Importance of DNS
Simplifies Internet Navigation: It enables us to access websites using domain names instead of complex numeric IP addresses, making the internet more user-friendly.
Scalability: It allows the internet to scale by supporting millions of domain names and corresponding IP addresses, enabling the seamless operation of websites, services, and applications across the globe.
Security: It helps in filtering malicious websites (through DNS-based filtering), preventing phishing attacks, and supporting additional security protocols to prevent data tampering.
Types of DNS Records
A (Address) Record:
Maps a domain name to its corresponding IPv4 address.
Example:
example.com
→192.0.2.1
AAAA (IPv6 Address) Record:
Maps a domain name to its corresponding IPv6 address.
Example:
example.com
→2001:0db8:85a3:0000:0000:8a2e:0370:7334
CNAME (Canonical Name) Record:
Creates an alias for an existing domain. It points a domain to another domain name, allowing multiple domain names to point to the same IP address.
Example:
www.example.com
→example.com
NS (Name Server) Record:
Specifies the authoritative name servers for a domain, directing queries to the DNS servers responsible for managing the domain.
Example:
example.com
→ns1.example.com
,ns2.example.com
PTR (Pointer) Record:
Used for reverse DNS lookups, where an IP address is mapped back to a domain name.
Example:
192.0.2.1
→example.com
DNS hierarchy
The hierarchy starts at the root and goes all the way down to the authoritative DNS servers.
1. Root Level (Root DNS Servers)
The DNS hierarchy starts at the very top with the root.
There are 13 root servers worldwide (labeled A through M), which are responsible for knowing where the servers for Top-Level Domains (TLDs) are located.
When a DNS query is first made (for example,
www.example.com
), if the resolver doesn't already know the IP address, it queries the root servers.The root server doesn’t have the exact IP for the domain but will direct the query to the appropriate TLD name servers (like
.com
,.org
,.net
).
2. Top-Level Domain (TLD) Servers
The next level in the hierarchy is the TLD name servers.
These servers are responsible for managing the domain extensions (like
.com
,.org
,.net
,.edu
, etc.).For example, if you’re querying “www.jaygovind-blogs.com“, the root DNS servers will direct your query to the
.com
TLD server.The TLD servers don't have the exact IP for the website either, but they know which authoritative DNS servers are responsible for the second-level domain
3. Authoritative DNS Servers (Second-Level Domain)
Authoritative DNS servers hold the actual DNS records (like
A
,MX
,CNAME
) for a specific domain, such as “www.jaygovind-blogs.com“.When the TLD server directs the query to the authoritative server for “www.jaygovind-blogs.com“, it is this server that contains the final and authoritative response for the IP address or other DNS records for the domain.
For example, it will have the mapping for “www.jaygovind-blogs.com“ →
192.0.2.1
(or whichever IP address is assigned).
What happens if a DNS root server becomes unavailable?
DNS Resolution/ Lookup
It is the process that helps devices and applications to translate readable domain names to the corresponding IP Addresses used by the computers for communicating over the web.
What Are The Steps in a DNS Lookup?
A user types “www.jaygovind-blogs.com” into a web browser.
The request goes to a DNS resolver.
The resolver asks a root server where to find the top-level domain (TLD) server for .com.
The root server tells the resolver to contact the .com TLD server.
The resolver then asks the .com TLD server for the IP address of “jaygovind-blogs.com”
The .com TLD server gives the resolver the IP address of the domain’s nameserver.
The resolver then asks the domain’s nameserver for the IP address of “jaygovind-blogs.com”
The domain’s nameserver returns the IP address to the resolver.
Example:
- Imagine you want to visit New York City (access a website), but you don’t know the exact flight details (IP address). First, you go to your local travel agent (DNS resolver), who checks if they already know the flight details. If not, they start searching. The agent first directs you to the airport’s main desk (root DNS servers), which doesn't know the exact flight but can point you to the right airline (e.g., international airlines for
.com
domains). The desk then sends you to the airline counter (TLD servers) responsible for your specific destination (likeexample.com
). Finally, the airline's own counter (authoritative DNS servers) provides the exact flight details (IP address). With the flight details, you board the plane (connect to the website) and arrive at your destination (the website). Each step involves delegating the search from one authority to the next, ultimately leading you to the correct destination.
Subscribe to my newsletter
Read articles from JAY GOVIND KUMAR directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
