DNS and Domain Names
Learn how human-friendly domain names are translated into IP addresses and which DNS records you will touch when deploying a site.
Beginner · about 2 hours · difficulty 1/5
Learn first: How the Internet Works
The Domain Name System is the internet's phone book. Browsers cannot connect to example.com directly; they need an IP address, and DNS provides it.
How a lookup works
- The browser checks its own cache, then the operating system cache.
- If nothing is cached, a recursive resolver (often run by your ISP, or public ones like 1.1.1.1 or 8.8.8.8) does the legwork.
- The resolver asks a root server, which points to the TLD server for
.com, which points to the domain's authoritative nameserver, which finally returns the record. - The answer is cached for as long as its TTL (time to live) allows.
Records you will actually use
- A / AAAA: name to IPv4 / IPv6 address.
- CNAME: an alias pointing to another name (common when a host like Vercel or Netlify gives you a target).
- TXT: arbitrary text, used for domain verification and email security (SPF, DKIM).
- MX: where email for the domain goes.
- NS: which nameservers are authoritative.
Pitfalls
- Changing a record does not take effect instantly for everyone: old answers live on until their TTL expires. Lower the TTL before a planned migration.
- A root (apex) domain like
example.comusually cannot be a CNAME; hosts offer ALIAS/ANAME records or specific A records instead.
You are ready to move on when you can point a custom domain at a hosted frontend and debug it with nslookup or dig.
Key concepts
- Resolvers, root, TLD and authoritative servers
- A and AAAA records
- CNAME and apex domains
- TTL and caching
- TXT, MX and NS records
- dig and nslookup: Command line lookup tools
- DNS over HTTPS
Mini project
Use dig or nslookup to inspect the A, CNAME, MX and TXT records of three well-known sites, and document which hosting or email providers they appear to use.
Check yourself
You changed an A record ten minutes ago but some users still hit the old server. What is the most likely reason?
Free resources
- What is DNS? (Cloudflare)
- What is a domain name? (MDN)