How DNS Works When You Open a Website

When you type a website address into your browser, the Domain Name System (DNS) translates that human-readable name into an IP address that computers use to communicate. Understanding DNS helps you troubleshoot connectivity issues, optimize performance, and configure your own domains.
The DNS Resolution Process
When you open https://www.example.com, the following happens:
1. Your computer checks its local DNS cache for a recent answer 2. If not cached, it queries the configured DNS resolver (usually your ISP's or a public resolver like 8.8.8.8) 3. The resolver checks its cache 4. If not cached, the resolver performs a recursive query starting from the root servers 5. Root servers direct the resolver to the .com TLD (Top-Level Domain) servers 6. TLD servers direct the resolver to example.com's authoritative nameservers 7. The authoritative nameserver returns the IP address for www.example.com 8. The resolver caches the answer and returns it to your computer 9. Your computer caches the answer and connects to the IP address
This entire process typically takes 10 to 100 milliseconds.
DNS Record Types
A Record
Maps a domain name to an IPv4 address. Example: www.example.com -> 203.0.113.50
AAAA Record
Maps a domain name to an IPv6 address.
CNAME Record
Creates an alias from one domain to another. Example: www.example.com -> example.com (the CNAME points to the canonical name, which then has an A record).
MX Record
Specifies mail servers for the domain. Used for email delivery.
TXT Record
Stores arbitrary text data. Used for domain verification, SPF records (email authentication), and other purposes.
NS Record
Specifies the authoritative nameservers for a domain.
TTL (Time to Live)
Each DNS record has a TTL value (in seconds) that tells resolvers how long to cache the answer. Common TTL values: - 300 seconds (5 minutes): used during migrations when you need quick propagation - 3600 seconds (1 hour): reasonable default for most records - 86400 seconds (24 hours): for stable records that rarely change
Lower TTL means faster propagation of changes but more frequent queries to your authoritative nameservers.
DNS Caching
DNS answers are cached at multiple levels: - Browser cache - Operating system cache - Resolver cache (ISP or public DNS)
Caching reduces latency for repeated lookups and reduces load on authoritative servers. When you change a DNS record, the old answer persists in caches until the TTL expires.
DNS Propagation
When you change a DNS record, the change propagates through the caching hierarchy over time. The effective propagation time is at most the TTL value of the previous record.
To minimize propagation time during a migration: lower the TTL to 300 seconds at least 24 hours before making the change. After the change propagates, restore the TTL to a normal value.
DNS for Server Administrators
Key DNS tasks: - Configure A records for your server's IP address - Set up CNAME records for subdomains - Configure MX records for email delivery - Use appropriate TTL values - Monitor DNS resolution for your domains
Common DNS Issues
- DNS propagation delays: changes take time to propagate through caches
- Incorrect records: wrong IP address or record type
- TTL too high: changes propagate slowly
- Nameserver misconfiguration: domain points to wrong nameservers
Understanding DNS is essential for anyone managing servers or domains. It is the foundation of how users reach your applications.
Key Takeaways
- **DNS resolution** is a multi-step chain (recursive resolver → root → TLD → authoritative) — a break at any point makes your domain unreachable regardless of your server status.
- **Record types serve distinct purposes**: A/AAAA for IP mapping, CNAME for aliases, MX for email routing, TXT for verification and SPF/DKIM.
- **TTL controls caching duration** — low TTLs (300s) allow faster propagation of changes but increase query volume to your authoritative nameservers.
- **DNS propagation delays** are caused by caching at every layer, not DNS itself; plan for 24–48 hours when changing nameservers.
- **Common DNS issues** (wrong A record, stale cache, misconfigured nameservers) are frequent causes of "site down" reports — always verify DNS before blaming the server.