DNS translates human-readable domain names (google.com) into machine-readable IP addresses (142.250.190.46). It’s the “phonebook of the internet.”
DNS Hierarchy
Root (.) — 13 root server clusters (e.g., a.root-servers.net)
└── TLD (.com, .org, .net) — managed by registries (Verisign for .com)
└── Authoritative (example.com) — the domain owner's DNS server
| Level | Role | Who runs it |
|---|---|---|
| Root | Knows where TLD servers are | ICANN (13 logical root clusters, hundreds of physical servers) |
| TLD | Knows where authoritative servers for each domain are | Registry operators |
| Authoritative | Knows the actual IP address for each domain | Domain owner (or their DNS provider) |
How DNS Resolution Works
Recursive Query
Your browser asks the recursive resolver (usually your ISP’s or Cloudflare’s 1.1.1.1) to find the IP. The resolver does all the work.
Iterative Query
The resolver asks each level in turn:
- Ask Root: “Who manages .com?” → Root points to TLD servers
- Ask TLD (.com): “Who manages google.com?” → TLD points to Google’s authoritative server
- Ask Authoritative (ns1.google.com): “What is the IP of google.com?” → Returns IP
DNS Record Types
| Record | Purpose | Example |
|---|---|---|
| A | Maps domain → IPv4 | google.com → 142.250.190.46 |
| AAAA | Maps domain → IPv6 | google.com → 2607:f8b0:... |
| CNAME | Maps domain → another domain (alias) | www.example.com → example.com |
| MX | Maps domain → mail server | @ → mail.example.com (with priority) |
| NS | Maps domain → name server | example.com → ns1.example.com |
| TXT | Arbitrary text (verification, SPF) | Used for email authentication |
DNS Uses UDP (Usually)
DNS queries are small and fast. UDP avoids the TCP handshake overhead. If the answer doesn’t fit in a single UDP packet (>512 bytes), the resolver falls back to TCP (via truncation flag).
Q: What are the levels of DNS servers?
A: Root servers (know where TLD servers are), TLD servers (know where authoritative servers are), Authoritative servers (know the actual IP). The recursive resolver queries each level in order.
Q: What are common DNS record types?
A: A (IPv4), AAAA (IPv6), CNAME (alias domain), MX (mail server), NS (name server), TXT (text records for SPF/verification).
Q: Why does DNS use UDP?
A: DNS queries are small and need low latency. UDP avoids the 3-way TCP handshake overhead, making queries faster. If the response is too large for UDP (>512 bytes), DNS falls back to TCP.
Q: What is DNS caching?
A: DNS responses are cached at every level (browser, OS, resolver, TLD) with a TTL (Time To Live). Caching reduces latency and load on authoritative servers. This is why DNS changes can take hours to propagate.
Premium Content
Unlock DNS (Domain Name System) and all premium lessons with a subscription.
From ₹199.99/year — See plans