TechBlog
system-design

DNS — How Domain Name System Works

DNS is the phonebook of the internet. Understanding how it works is essential for system design — from latency to failover to global load balancing.

3 min read

What is DNS?

DNS translates human-readable domain names into IP addresses.

techpaths.dev → DNS lookup → 76.76.21.21

How DNS Resolution Works

This entire chain takes 20-120ms on first lookup. Subsequent lookups are served from cache.


DNS Record Types

RecordPurposeExample
ADomain → IPv4techpaths.dev → 76.76.21.21
AAAADomain → IPv6techpaths.dev → 2606::...
CNAMEAlias to another domainwww → techpaths.dev
MXMail server→ mail.google.com
TXTVerification, SPF, DKIMv=spf1 include:...
NSAuthoritative name servers→ ns1.cloudflare.com

TTL and Propagation

Before a migration: Lower TTL to 60s a day before, make the change, then raise it back.


GeoDNS — Global Load Balancing


Anycast Routing

Multiple servers share the same IP. Network routes each user to the nearest one.


DNS Failover


Key Takeaway