How DNS Works?
DNS is the internet's phone book: it converts the domain names humans remember into the IP addresses machines use. You type `google.com`, DNS finds `142.250.185.78`.
01Why DNS?
Which is easier to memorize?
142.250.185.78google.com
People like names, computers like numbers. DNS bridges the two — and without that bridge the web would be practically unusable.
02The DNS query process
When you type an address, the answer is searched for starting at the nearest place; if it isn't found, the chain extends upward:
- Browser cache — did you look this domain up just now?
- OS cache — does the operating system know the answer?
- Router cache — is it stored on your home router?
- ISP DNS (recursive resolver) — your provider goes looking on your behalf
- Root DNS — answers "who knows about
.com?" - TLD DNS — the
.comservers say "that host knows example.com" - Authoritative DNS — the domain's own server gives the real answer
On the way back, every layer caches the answer for its TTL (time to live) — which is why the second lookup is far faster.
03DNS record types
| Record | Description | Example |
|---|---|---|
| A | IPv4 address | example.com → 93.184.216.34 |
| AAAA | IPv6 address | example.com → 2606:2800:... |
| CNAME | Alias | www → example.com |
| MX | Mail server | mail.example.com |
| TXT | Text info | Domain verification, SPF |
| NS | Authoritative server | ns1.example.com |
04Try it yourself
Query a real domain in the simulator below: watch which steps the query passes through, how the chain shortens on a cache hit, and what TTL does.
Sandbox · ProtocolDNS LookupStep through recursive resolution: play with cache hits, TTL, and record types.Open tool05Summary
- DNS = the distributed system that maps names to IPs
- Answers are checked in caches first, then root → TLD → authoritative
- TTL controls how long an answer stays cached
- A records are IPv4, AAAA are IPv6, CNAME defines an alias