DNS (Domain Name System)
How DNS works step-by-step
- Client asks a recursive resolver (often ISP/company/1.1.1.1/8.8.8.8).
- Resolver checks cache; if miss, it walks:
- Root → TLD (e.g.,
.com) → authoritative nameserver for the domain.
- Resolver returns the record to the client and caches it for the TTL.
A, AAAA, CNAME, MX records
- A: name → IPv4 address.
- AAAA: name → IPv6 address.
- CNAME: alias one name to another canonical name.
- MX: mail exchanger servers for a domain (email routing).
DNS resolution flow
- App/OS may consult hosts file / local cache first.
- Resolver returns answers with TTL; negative caching can apply for NXDOMAIN.
- Many systems do retries across multiple resolvers; timeouts often look like “site is down”.
TTL and caching
- TTL controls how long resolvers cache answers.
- Lower TTL helps faster failover/changes but increases query volume.
- Beware multi-layer caching: browser, OS, resolver, upstream.
DNS in cloud (Route53 / equivalents conceptually)
- Managed DNS services host authoritative zones, support health checks and routing policies.
- Common patterns: alias records to load balancers, weighted routing, geo/latency-based routing.