DNS Troubleshooting & Cache Flushing
Diagnose DNS propagation issues, query authoritative nameservers with dig and nslookup, and flush local OS DNS caches.
1. Querying Specific Nameservers with dig
When updating domain DNS records, your local ISP cache might show old cached records. Query public resolvers directly with dig:
# Query Cloudflare DNS (1.1.1.1)
dig @1.1.1.1 api.example.com +short
# Query Google DNS (8.8.8.8)
dig @8.8.8.8 api.example.com +short
# Query Authoritative Nameserver directly (Bypasses all caches)
dig @ns1.cloudflare.com api.example.com A2. Inspecting DNS Record Types
# Query MX (Mail Exchange) records
dig example.com MX +short
# Query TXT records (SPF, DKIM, site verification)
dig example.com TXT +short
# Trace full resolution chain from root nameservers down (+trace)
dig example.com +trace3. Flushing Local Operating System DNS Caches
When a server IP changes, your local OS might cache the previous IP until TTL expires:
macOS
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderLinux (systemd-resolved)
sudo resolvectl flush-caches
# or on older Ubuntu:
sudo systemd-resolve --flush-cachesWindows (PowerShell / Command Prompt)
ipconfig /flushdns4. Temporary Overrides via /etc/hosts
To test a new server deployment before switching live public DNS:
# /etc/hosts
203.0.113.50 api.example.comThis forces your local computer to route api.example.com to 203.0.113.50 immediately, bypassing all DNS queries.
CORS vs Networking & Firewalls
Demystify why CORS is strictly a browser security policy and why network firewalls, curl, and backend servers never experience CORS errors.
Developer Network Diagnostic Tools Cheatsheet
Master essential network diagnostic utilities (curl, ping, traceroute, dig, ss, netstat, lsof, netcat) for debugging connectivity.