DNS & How Names Resolve
Understand how human names become IP addresses, and the record types you'll meet.
DNS is the internet’s phone book: it turns a name like example.com into an
IP address. Resolution walks a hierarchy — a resolver asks the root
servers, then the TLD (.com) servers, then the domain’s authoritative
nameserver, caching answers along the way according to each record’s TTL.
The record types you must know:
- A / AAAA — name → IPv4 / IPv6 address
- CNAME — name → another name (alias)
- MX — mail servers for a domain
- TXT — arbitrary text (SPF, domain verification)
- NS — which nameservers are authoritative
graph LR C["Client"] --> R["Resolver"] R --> Root["Root servers"] R --> TLD[".com TLD"] R --> Auth["Authoritative NS"] Auth --> R R --> C
dig example.com # full answer with record + TTL
dig +short example.com # just the IP
dig example.com MX # mail records
nslookup example.com # simpler interactive lookup
dig @1.1.1.1 example.com # query a specific resolver - Use
dig +shortto find the A record of a site you use. - Look up the MX records for a domain and identify its mail provider.
- Query two different public resolvers and compare the TTL values.
- Explain why a DNS change you made isn’t visible yet on another machine.
Cheat Sheet▾
| Record | Maps | Example |
|---|---|---|
| A | name → IPv4 | 93.184.216.34 |
| AAAA | name → IPv6 | 2606:2800:: |
| CNAME | name → name | www → example.com |
| MX | mail servers | 10 mail.example.com |
| TXT | text | SPF, verification |
| NS | nameservers | ns1.example.com |
Common Interview Questions▾
Walk through what happens during a DNS lookup.
The resolver checks its cache, then queries the root, the TLD servers, and finally the domain’s authoritative nameserver, returning the record and caching it for the TTL duration.
What's the difference between an A record and a CNAME?
An A record points a name directly to an IP address. A CNAME points a name to another name (an alias), which is then resolved to an IP.
What is TTL and why does it matter?
Time To Live is how long a record may be cached. High TTLs reduce lookups but make changes propagate slowly; lower it before planned DNS changes.