DNS
How DNS works behind the scenes
"How does DNS work in the backend?" is a favourite interview question, usually as part of "what happens when you type a URL". A strong answer goes beyond "it turns names into IPs": it walks the full resolution path — stub resolver, recursive resolver, root, TLD, authoritative — explains caching at every layer, shows it with dig +trace, and then applies it to real systems: Linux resolution order, the VPC resolver, CoreDNS in Kubernetes with its ndots:5 behaviour, and the security problems DNS is famous for.
After this topic you can
- Trace a DNS lookup from the browser to the authoritative server
- Use dig to find where resolution breaks
- Explain recursive and authoritative servers
Lessons
-
1The actors and the namespace
- What DNS does
- The namespace tree
- The four kinds of servers in a lookup
-
2A lookup from start to finish
- Step by step: resolving api.example.com cold
- The warm path
- See it yourself
-
3Root servers, TLDs and the governance behind them
- Root servers
- TLDs, registries and registrars
-
4DNS messages and transport
- Message structure
- Transport
-
5The client side: how Linux resolves names
- Resolution order
- resolv.conf
- Application runtimes
-
6Inside a recursive resolver
- What a good resolver does
- When the resolver is the problem
-
7DNS in AWS VPCs and Kubernetes
- The VPC resolver
- CoreDNS in Kubernetes
- The ndots:5 multiplier
- Debugging DNS in EKS
-
8DNS security and abuse
- Cache poisoning
- Amplification and open resolvers
- Exfiltration and tunnelling
- Hijacking
- Why companies run internal DNS
-
9Interview questions and model answers
- "Explain how DNS resolution works end to end."
- "How many root servers are there?"
- "What's the difference between a recursive and an iterative query?"
- "dig resolves a name but the application can't. Why?"
- "Pods resolve Services in their namespace but not another namespace's short name. Why?"
- "Kubernetes DNS is slow and CoreDNS CPU is high. What do you do?"
- "What is DNS cache poisoning and how is it prevented?"
- "Why shouldn't you run an open recursive resolver?"