The Magic of DNS: How the Internet Knows Where to Go

Learning web development in public. Writing simple, real-world explanations about web development concepts. Helping beginners understand why things work, not just how.
Search for a command to run...

Learning web development in public. Writing simple, real-world explanations about web development concepts. Helping beginners understand why things work, not just how.
No comments yet. Be the first to comment.
Every day, millions of users upload photos, videos, stories, and reels to Instagram. From a user's perspective, the process appears simple: select media, apply filters, add a caption, and tap "Post."
Building Offline-First Messaging Apps: How Messages Work Without Internet Modern messaging applications have transformed the way people communicate. Whether it's chatting with friends, collaborating w
In this article we'll explore about the Expo Router and React Navigation and answer which one to use in 2026. If you build mobile apps using React Native, one thing becomes obvious very quickly: Navig

Modern mobile apps are no longer just a collection of screens connected together. Apps like Instagram, WhatsApp, Uber, and Netflix operate at massive scale with millions of users, real time systems, o
In this article we'll be exploring react.js and the things of react.js that makes it popular and stand out among other libraries ( no fight over library vs framework ). We'll go through: What problem

Shkaai
68 posts
DNS (Domain Name System) is like the phonebook of the internet. Instead of remembering complex IP addresses (e.g., 172.217.169.78), DNS lets you type human-friendly domain names (like google.com) and magically finds the correct address for your request.
But behind the scenes, DNS is a complex, hierarchical, and distributed system that involves multiple layers of caching, queries, and records to ensure websites load almost instantly.
When you type google.com in your browser, a series of events take place:
Browser Cache Check:
google.com. If found, it uses the cached IP.OS-Level Cache Check:
Recursive DNS Resolver (ISP DNS or Custom DNS like Google DNS 8.8.8.8)
Root DNS Server Lookup:
If the resolver doesn’t know the answer, it asks the Root DNS Servers (located globally).
The root servers don’t store IPs but tell the resolver where to find the TLD Name Servers.
TLD (Top-Level Domain) Name Server Lookup:
For google.com, the .com TLD Name Server (operated by Verisign) is queried.
It doesn’t have the exact IP but directs the resolver to the Authoritative Name Server for google.com.
Authoritative Name Server Lookup:
Response and Caching:
The resolved IP (142.250.190.14 for google.com) is sent back to your browser.
The result is cached at multiple levels to speed up future lookups.
Connecting to the Website:
Resolvers:
8.8.8.8, Cloudflare DNS 1.1.1.1).Root Name Servers:
There are 13 root name servers globally, operated by different organizations (e.g., Verisign, ICANN).
These act as the starting point for DNS resolution.
TLD (Top-Level Domain) Servers:
.com, .org, .net, .in, etc.Authoritative Name Servers:
google.com).DNS stores different types of records, each serving a purpose:
A Record: Maps a domain to an IPv4 address.
AAAA Record: Maps a domain to an IPv6 address.
CNAME Record: Creates an alias for a domain (e.g., www.example.com → example.com).
MX Record: Used for email servers (Mail Exchange).
TXT Record: Stores arbitrary text (used in SPF, DKIM, and security verification).
NS Record: Points to the authoritative name servers.
PTR Record: Used for reverse DNS lookup (IP → Domain).
DNS caching helps avoid redundant queries by storing previously resolved addresses. It occurs at multiple levels:
Browser Cache
Operating System Cache
ISP Resolver Cache
CDN & Edge Servers Cache (like Cloudflare, Akamai)
💡 Example:
If you visit facebook.com, your resolver caches the IP. The next time, it fetches it instantly without querying root/TLD servers.
While DNS is powerful, it has vulnerabilities:
Attackers trick your resolver into storing a fake IP for a domain.
This redirects users to malicious sites.
DNSSEC (DNS Security Extensions) → Uses cryptographic signatures to verify responses.
Encrypted DNS (DoH & DoT) → Encrypts DNS queries to prevent spying and manipulation.
DoH (DNS over HTTPS): Encrypts DNS traffic using HTTPS (e.g., Cloudflare 1.1.1.1).
DoT (DNS over TLS): Encrypts DNS using TLS for extra security.
💡 The first ever domain name registered was symbolics.com (1985).
💡 Google processes trillions of DNS queries every day.
💡 The .com TLD is the most popular, followed by .org and .net.
💡 Facebook, Google, and Cloudflare operate their own public DNS servers (8.8.8.8, 1.1.1.1).
💡 DNS is highly resilient—even if some servers fail, your internet still works due to redundancy.
🔹 Websites like youtube.com, amazon.com depend on fast DNS resolution to load quickly.
🔹 Businesses use CDNs (like Cloudflare, Akamai) to route traffic via the nearest server for speed.
🔹 ISPs often log DNS queries—privacy-focused users switch to Google DNS 8.8.8.8 or Cloudflare 1.1.1.1.
DNS is the backbone of the internet, translating domain names into IPs in milliseconds. It’s fast, distributed, and resilient, making web browsing seamless. Whether you're streaming Netflix, checking emails, or visiting a website, DNS is always working behind the scenes to connect you to the right place.