What Is DNS?
Domain Name System
DNS is the internet's phone book — it translates human-readable domain names (google.com) into IP addresses (142.250.80.46) that computers use to find each other. Every website visit starts with a DNS lookup.
How DNS Works
When you type google.com, your browser asks a DNS resolver (usually your ISP or Cloudflare 1.1.1.1) for the IP address. The resolver checks its cache, then queries root servers, TLD servers (.com), and authoritative nameservers until it finds the answer.
DNS records come in several types: A records map domains to IPv4 addresses, AAAA to IPv6, CNAME creates aliases, MX handles email routing, TXT stores verification strings, and NS delegates to nameservers.
DNS propagation — the time it takes for changes to spread across all DNS servers — can take up to 48 hours. In practice, most changes propagate within minutes to hours depending on TTL settings.
Why Developers Use DNS
Developers interact with DNS when setting up domains, configuring email, and pointing subdomains to different services. Cloudflare, Route 53 (AWS), and Google Cloud DNS are popular managed DNS providers. Understanding DNS is essential for debugging 'site not loading' issues.
Key Concepts
- A Record — Maps a domain name to an IPv4 address — the most common record type
- CNAME — Creates an alias from one domain to another — api.example.com → myapp.herokuapp.com
- TTL — Time-to-Live — how long DNS resolvers cache a record before checking for updates
- Nameserver — The authoritative server that holds the actual DNS records for a domain
- DNS Propagation — The time it takes for DNS changes to spread across the internet's DNS resolver network
- MX Record — Specifies the mail server responsible for receiving email for a domain
Common DNS Commands
# Look up A record
dig google.com A
# Look up all DNS records
dig example.com ANY
# Query specific DNS server
nslookup example.com 1.1.1.1
# Trace the full DNS resolution path
dig +trace example.com Frequently Asked Questions
Why is my domain not working after I changed DNS?
DNS propagation takes time. Old cached records must expire (based on TTL) before the new ones take effect. Wait 15 minutes to 48 hours, or flush your local DNS cache with ipconfig /flushdns (Windows) or dscacheutil -flushcache (macOS).
What DNS provider should I use?
Cloudflare (free, fast, with DDoS protection) is the most popular. AWS Route 53 is common for AWS-heavy setups. Google Cloud DNS is another solid option.
What is DNS-over-HTTPS?
DNS-over-HTTPS (DoH) encrypts DNS queries so your ISP can't see which sites you visit. Firefox and Chrome support it natively. Cloudflare (1.1.1.1) and Google (8.8.8.8) both offer DoH.