DNS is the internet’s most critical invisible infrastructure. When it works, nobody notices. When it breaks, everything stops working and suddenly everyone’s a DNS expert with opinions about TTL values.

Understanding DNS isn’t academic—it’s survival. One misconfigured record can take your entire application offline. One wrong TTL setting can turn a 5-minute fix into a 24-hour outage.

Here’s how DNS actually works and how to avoid the footguns that will ruin your weekend.

The DNS Hierarchy: Delegation All the Way Down

DNS is a distributed system built like a corporate org chart—everyone passes the buck until someone actually knows the answer.

When you type dualpony.com into your browser, here’s the conversation that happens in milliseconds:

  1. Your computer asks the root servers (.): “Who handles .com domains?”

    • Root servers: “Ask the .com TLD servers at these IP addresses”
  2. Your computer asks .com TLD servers: “Who handles dualpony.com?”

    • TLD servers: “Ask dualpony’s authoritative nameservers”
  3. Your computer asks authoritative nameservers: “What’s the IP for dualpony.com?”

    • Authoritative servers: “Here’s the actual IP address: 192.168.1.1”

This hierarchical delegation is why DNS is both incredibly resilient and occasionally maddening. Changes propagate through multiple layers of caching, each with their own ideas about how long to remember things.

TTL: Time To Live (And Time To Regret Your Choices)

TTL is how long DNS records get cached before being refreshed. Set it wrong and you’re either waiting forever for changes to take effect or getting billed for excessive DNS queries.

Common TTL values and their trade-offs:

  • 86400s (24 hours): Great for records that never change, terrible for anything you might need to update quickly
  • 3600s (1 hour): Good default for most records
  • 300s (5 minutes): Use before making changes, then increase afterward
  • 60s (1 minute): Emergency mode only—your DNS provider will start charging extra

Pro strategy: Before any significant DNS change, lower your TTL to 300s about 24 hours in advance. Make your change, verify it works globally, then bump the TTL back up to 3600s. This gives you a quick escape route if things go wrong.

DNS Records: The Essential Types

A and AAAA Records: The Basic Building Blocks

dualpony.com.     A     192.168.1.1      # IPv4 address  
dualpony.com.     AAAA  2001:db8::1      # IPv6 address

CNAME: The Alias That Causes Confusion

CNAME records point one domain name to another domain name (not an IP address):

www.dualpony.com. CNAME dualpony.com.
cdn.dualpony.com. CNAME d1234.cloudfront.net.

Critical rule: You cannot have a CNAME record alongside any other record type for the same name. This breaks things in weird, unpredictable ways.

MX Records: Email’s Special Snowflake

Email routing uses MX records with priority numbers (lower number = higher priority):

dualpony.com. MX 10 mail.dualpony.com.
dualpony.com. MX 20 backup-mail.dualpony.com.

The trailing dot matters. mail.dualpony.com without a trailing dot becomes mail.dualpony.com.dualpony.com. and your emails disappear into the DNS void.

TXT Records: The Junk Drawer of DNS

TXT records hold arbitrary text and are used for everything from email authentication to domain verification:

dualpony.com. TXT "v=spf1 include:_spf.google.com ~all"
dualpony.com. TXT "google-site-verification=abc123def456"

Common DNS Footguns That Will Destroy Your Day

The CNAME Root Domain Trap

You cannot put a CNAME record on your root domain (dualpony.com) because it conflicts with required records like MX and NS. Some DNS providers let you do it anyway, but it breaks email and other services unpredictably.

Wrong:

dualpony.com. CNAME cdn.dualpony.com.  # This breaks everything

Right:

dualpony.com.     A     192.168.1.1
www.dualpony.com. CNAME cdn.dualpony.com.

Wildcard Records: The Footgun That Keeps Giving

*.dualpony.com seems convenient until you realize it catches everything:

*.dualpony.com. A 192.168.1.1

This matches:

  • api.dualpony.com ✅ (intended)
  • staging.dualpony.com ✅ (intended)
  • secret-admin-panel.dualpony.com đŸ˜± (unintended)
  • literally-anything.dualpony.com đŸ˜± (unintended)

Better approach: Create explicit records for each subdomain you actually need.

The Propagation Myth That Won’t Die

“DNS propagation takes 24-48 hours” is the biggest lie in web development. Here’s what actually happens:

  1. Your authoritative DNS server updates instantly
  2. Recursive resolvers worldwide cache records for the TTL duration
  3. Your browser caches DNS responses (often ignoring TTL)
  4. Your operating system caches DNS responses too

Most “propagation” issues are local caching problems, not global DNS delays.

Quick debugging:

# Check what your system is seeing
nslookup dualpony.com

# Bypass all caches, query authoritative server directly  
nslookup dualpony.com 8.8.8.8

# Force refresh on Windows
ipconfig /flushdns

# Force refresh on macOS/Linux
sudo dscacheutil -flushcache

Email DNS: The Special Circle of Hell

If your application sends email, you need these DNS records or your messages will end up in spam folders:

SPF: Sender Policy Framework

Tells email providers which servers are allowed to send email for your domain:

dualpony.com. TXT "v=spf1 include:_spf.google.com ~all"

DMARC: Domain-based Message Authentication

Tells email providers what to do with emails that fail authentication:

_dmarc.dualpony.com. TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc@dualpony.com"

Start with p=none to monitor before enforcing. Going straight to p=reject can block legitimate emails.

DKIM: DomainKeys Identified Mail

A cryptographic signature that proves emails actually came from your domain. Your email provider usually handles this, but you’ll need to add their public key to your DNS:

selector._domainkey.dualpony.com. TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3..."

Testing and Monitoring: Don’t Learn About DNS Problems From Users

Essential Tools

  • whatsmydns.net: Shows DNS resolution from servers worldwide
  • dig: The power user’s DNS lookup tool (built into macOS/Linux)
  • DNSChecker: Validates your records before you push changes

Testing Commands That Actually Help

# Check A record
dig dualpony.com A

# Check MX records for email
dig dualpony.com MX

# Trace the full DNS resolution path  
dig +trace dualpony.com

# Check a specific DNS server
dig @8.8.8.8 dualpony.com

Monitoring That Matters

Set up monitoring for your critical DNS records. Services like UptimeRobot or Pingdom can alert you when DNS resolution fails before your users notice.

Monitor these records:

  • Your main domain (A/AAAA records)
  • www subdomain (CNAME)
  • MX records (email delivery)
  • Any subdomains critical to your application

DNS Disaster Recovery: When Everything Is On Fire

The Emergency Checklist

  1. Don’t panic-edit everything—you’ll make it worse
  2. Verify the problem is actually DNS—test with IP addresses directly
  3. Check your authoritative nameservers—are they responding?
  4. Review recent changes—DNS problems are usually human error

Quick Fixes for Common Problems

  • Wrong IP address: Fix the A record and wait for TTL to expire
  • Broken CNAME: Verify the target domain resolves correctly
  • Missing subdomain: Add the record and flush local DNS cache
  • Email not delivering: Check MX records and SPF/DMARC configuration

The Nuclear Option

If you’ve completely broken your DNS:

  1. Contact your domain registrar—they can help fix nameserver records
  2. Use a CDN as a proxy—Cloudflare can route traffic while you fix DNS
  3. Communicate via social media—email might be broken too

DNS Security: Beyond Basic Setup

DNSSEC: Cryptographic DNS Verification

DNSSEC cryptographically signs DNS records to prevent hijacking attacks. It’s technically elegant and operationally complex. Unless you’re handling sensitive financial data, the complexity usually outweighs the benefits.

DNS-over-HTTPS (DoH) and DNS-over-TLS (DoT)

These encrypt DNS queries to prevent eavesdropping. Most modern browsers support DoH automatically, but be aware it can complicate corporate network filtering and monitoring.

Real-World DNS Best Practices

Provider Selection

Don’t use your registrar’s free DNS—it’s usually slow and unreliable. Use a dedicated DNS service:

  • Cloudflare: Fast, free tier available, excellent uptime
  • Route 53: Expensive but integrates well with AWS
  • NS1: Advanced features for complex setups

Configuration Management

Document everything. DNS configurations that aren’t documented are DNS disasters waiting to happen. Keep a record of:

  • What each record does
  • When it was last changed and why
  • Dependencies between records
  • Emergency contact information for your DNS provider

Backup Strategy

Have a secondary DNS provider configured. Most registrars let you set multiple nameservers. Configure identical records on two different providers so you can switch quickly if one goes down.

The Bottom Line

DNS is invisible until it breaks, then it breaks everything. The key to DNS success is:

  1. Understand the caching layers—most problems are caching problems
  2. Use appropriate TTL values—balance between performance and flexibility
  3. Test changes thoroughly—DNS mistakes affect everyone immediately
  4. Monitor critical records—know about problems before your users do
  5. Have a disaster recovery plan—because DNS always breaks at the worst time

DNS was designed by people who expected everything to fail gracefully. Your DNS strategy should embrace the same philosophy: plan for failure, monitor everything, and always have a backup plan.