DNS
What is it?
DNS is the system that translates human-friendly domain names like example.com into the numeric IP addresses computers use to find each other.
Explain like I'm 5
Why was it created?
People can't remember strings of numbers for every site, so DNS was created to map memorable names to changing IP addresses.
Where is it used?
- Resolving website domains
- Routing email to mail servers
- Service discovery in infrastructure
- Load distribution across regions
Why should developers care?
DNS underlies every domain you visit. Misconfigured DNS is a common cause of outages developers must debug.
How does it work?
When you request a domain, your computer asks DNS resolvers, which walk a hierarchy of servers until they find the record mapping the name to an IP. Results are cached for a set time (TTL).
Real-world example
Visiting a site triggers a DNS lookup that returns its server's IP; your browser then connects to that address to load the page.
Common use cases
- Pointing a domain at a server
- Email delivery (MX records)
- Verifying domain ownership (TXT records)
- Geographic traffic routing
Advantages
- Human-friendly names
- Decouples names from changing IPs
- Caching makes it fast
- Globally distributed and resilient
Disadvantages
- Caching means changes can take time to propagate
- Misconfiguration causes hard-to-spot outages
- Can be a target for attacks
When should you use it?
Whenever you publish a service under a domain name.
When should you avoid it?
You can't really avoid it for named services; you only choose how to manage it.
Alternatives
Related terms
Interview questions
Beginner
- What does DNS do?
- What is an A record?
Intermediate
- What is TTL and how does it affect changes?
- What is the difference between A and CNAME records?
Senior
- How would you reduce DNS-related downtime during a migration?
- How does DNS-based traffic routing work?
Common misconceptions
- "DNS changes take effect instantly" — caching and TTLs can delay propagation.
- "DNS stores website content" — it only maps names to addresses, not the pages themselves.
Fun facts
- DNS stands for Domain Name System.
- A record's TTL tells resolvers how long to cache it before checking again.
Timeline
- 1983 — DNS introduced to replace manual host files
Learning resources
Quick summary
DNS is the internet's directory, turning domain names into the IP addresses computers use to connect.
Cheat sheet
- Maps domain names to IPs
- Hierarchical and cached (TTL)
- A, CNAME, MX, TXT records
- Changes take time to propagate