Opscraft
DNS

How DNS works behind the scenes

Must-know9 lessons · 30 min · 3 tests ·

"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.

Stage 1 · Foundations

Know these first

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

  1. 1The actors and the namespace 3 min read
    • What DNS does
    • The namespace tree
    • The four kinds of servers in a lookup
  2. 2A lookup from start to finish 4 min read
    • Step by step: resolving api.example.com cold
    • The warm path
    • See it yourself
  3. 3Root servers, TLDs and the governance behind them 3 min read
    • Root servers
    • TLDs, registries and registrars
  4. 4DNS messages and transport 3 min read
    • Message structure
    • Transport
  5. 5The client side: how Linux resolves names 3 min read
    • Resolution order
    • resolv.conf
    • Application runtimes
  6. 6Inside a recursive resolver 3 min read
    • What a good resolver does
    • When the resolver is the problem
  7. 7DNS in AWS VPCs and Kubernetes 5 min read
    • The VPC resolver
    • CoreDNS in Kubernetes
    • The ndots:5 multiplier
    • Debugging DNS in EKS
  8. 8DNS security and abuse 3 min read
    • Cache poisoning
    • Amplification and open resolvers
    • Exfiltration and tunnelling
    • Hijacking
    • Why companies run internal DNS
  9. 9Interview questions and model answers 3 min read
    • "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?"