Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

DNS (Domain Name System)
CN

DNS (Domain Name System)

The phonebook of the internet: Master how domain names are converted into IP addresses.

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
LevelRoleWho runs it
RootKnows where TLD servers areICANN (13 logical root clusters, hundreds of physical servers)
TLDKnows where authoritative servers for each domain areRegistry operators
AuthoritativeKnows the actual IP address for each domainDomain 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:

  1. Ask Root: “Who manages .com?” → Root points to TLD servers
  2. Ask TLD (.com): “Who manages google.com?” → TLD points to Google’s authoritative server
  3. Ask Authoritative (ns1.google.com): “What is the IP of google.com?” → Returns IP

DNS Record Types

RecordPurposeExample
AMaps domain → IPv4google.com → 142.250.190.46
AAAAMaps domain → IPv6google.com → 2607:f8b0:...
CNAMEMaps domain → another domain (alias)www.example.com → example.com
MXMaps domain → mail server@ → mail.example.com (with priority)
NSMaps domain → name serverexample.com → ns1.example.com
TXTArbitrary 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.

My Private Notes

Notes are auto-saved locally to this device.