$ ./mactechbuds.sh
Starting MacTechBuds...
Blog engine loaded ✓
AI tools ready ✓
Bash scripts active ✓
Timer system ready ✓
Theme engine active ✓
Dev tools online ✓
mactechbuds.com >
Back to Tech Thoughts

DNS Configuration on macOS

Overview

DNS (Domain Name System) configuration on macOS affects every network connection. This guide covers the basics of changing DNS servers, flushing the DNS cache, and configuring DNS via MDM for enterprise environments.

Changing DNS via System Settings

Go to System Settings → Network → Wi-Fi (or Ethernet) → Details… → DNS. Click + to add a DNS server. Common choices:

  • Cloudflare: 1.1.1.1 and 1.0.0.1
  • Google: 8.8.8.8 and 8.8.4.4
  • OpenDNS: 208.67.222.222 and 208.67.220.220

Flushing DNS Cache

bash
# Flush DNS cache (macOS Monterey and later)
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

# Verify DNS resolution
dig +short apple.com @1.1.1.1
nslookup apple.com 8.8.8.8

DNS via MDM (Jamf / Kandji)

Push a DNS Settings payload in a configuration profile to enforce corporate DNS servers on managed devices. In Jamf Pro, navigate to Computers → Configuration Profiles → + New → DNS Settings. You can configure DNS over HTTPS (DoH) or DNS over TLS (DoT) for additional privacy.

Troubleshooting DNS

bash
# Show current DNS servers
scutil --dns | grep nameserver

# Test specific DNS server
dig apple.com @8.8.8.8

# Check mDNS (Bonjour) status
dns-sd -q _services._dns-sd._udp.local PTR