What Happens When You Type a URL
Your browser asks a recursive resolver. The resolver asks the root servers. The root servers point to the TLD servers. The TLD servers point to the authoritative nameserver. The authoritative nameserver returns the IP address.
Why DNS Breaks
DNS is cached at every level -- browser, OS, ISP, recursive resolver. When you change a DNS record, the old value persists until every cache expires. This is why "it takes up to 48 hours to propagate" is a thing.
Building a Resolver
Implementing a DNS resolver from scratch taught me the protocol intimately. Parsing DNS messages is a lesson in binary protocol design. Each record type has its own wire format, and handling compressed domain names is surprisingly tricky.
Practical Tips
- Always set reasonable TTLs (300-3600 seconds)
- Use dig to debug DNS issues, not nslookup
- Remember that DNS is UDP by default, TCP for large responses
- DNSSEC is important but still poorly deployed