#!/bin/bash # DNS debug for burmese.rooves.house. Run on each Mac: bash dns-debug.sh # Writes dns-debug-.txt in the current folder. No sudo needed. NAME="${1:-burmese.rooves.house}" OUT="dns-debug-$(scutil --get LocalHostName 2>/dev/null || hostname -s).txt" section() { printf '\n===== %s =====\n' "$1"; } { section "Host / OS" echo "Host: $(scutil --get ComputerName 2>/dev/null) ($(hostname))" sw_vers date # Find the Wi-Fi interface (usually en0, but not always on Mac Pro) WIFI_DEV=$(networksetup -listallhardwareports | awk '/Wi-Fi|AirPort/{getline; print $2; exit}') WIFI_SVC=$(networksetup -listallnetworkservices | grep -iE 'wi-?fi' | head -1) echo "Wi-Fi device: ${WIFI_DEV:-not found} service: ${WIFI_SVC:-not found}" section "Active interfaces and addresses" for i in $(ifconfig -l); do addrs=$(ifconfig "$i" 2>/dev/null | awk '/inet6? /{print $1, $2}' | grep -v 'fe80\|127.0.0.1\|::1') [ -n "$addrs" ] && echo "$i:" && echo "$addrs" | sed 's/^/ /' done section "Default routes" route -n get default 2>/dev/null | grep -E 'gateway|interface' route -n get -inet6 default 2>/dev/null | grep -E 'gateway|interface' section "DHCP info on Wi-Fi" ROUTER=$(ipconfig getoption "$WIFI_DEV" router 2>/dev/null) echo "Router: ${ROUTER:-none}" echo "DHCP DNS: $(ipconfig getoption "$WIFI_DEV" domain_name_server 2>/dev/null)" echo "DHCP domain: $(ipconfig getoption "$WIFI_DEV" domain_name 2>/dev/null)" section "Manual DNS override on Wi-Fi service" networksetup -getdnsservers "$WIFI_SVC" networksetup -getsearchdomains "$WIFI_SVC" section "Service order (first wins)" networksetup -listnetworkserviceorder | grep -E '^\(' section "scutil --dns (full resolver config)" scutil --dns section "/etc/resolver overrides" if [ -d /etc/resolver ]; then for f in /etc/resolver/*; do echo "--- $f"; cat "$f"; done else echo "none" fi section "/etc/hosts entries for rooves" grep -i rooves /etc/hosts || echo "none" section "VPNs / network extensions" scutil --nc list ifconfig -l | tr ' ' '\n' | grep -E '^utun|^ipsec|^ppp' | tr '\n' ' '; echo systemextensionsctl list 2>/dev/null | grep -iE 'network|dns|vpn|filter' || echo "no network/DNS system extensions listed" section "Configuration profiles (DNS settings show up here)" profiles list 2>&1 | head -30 profiles show -type configuration 2>/dev/null | grep -iE 'dns|ServerURL|ServerAddresses|PayloadDisplayName' | head -30 section "System resolver lookup (what apps see)" dscacheutil -q host -a name "$NAME" [ -z "$(dscacheutil -q host -a name "$NAME")" ] && echo "FAILED: no result" section "mDNSResponder lookup (3s)" dns-sd -G v4v6 "$NAME" > /tmp/dnssd.$$ 2>&1 & PID=$!; sleep 3; kill $PID 2>/dev/null; wait $PID 2>/dev/null cat /tmp/dnssd.$$; rm -f /tmp/dnssd.$$ section "Direct queries to each nameserver" SERVERS=$( (scutil --dns | awk '/nameserver\[/{print $3}'; echo "$ROUTER") | sort -u | grep -v '^$') for s in $SERVERS; do printf '%-40s A: %-20s AAAA: %s\n' "$s" \ "$(dig @"$s" "$NAME" A +short +time=2 +tries=1 2>&1 | tr '\n' ' ')" \ "$(dig @"$s" "$NAME" AAAA +short +time=2 +tries=1 2>&1 | tr '\n' ' ')" done section "Who is authoritative publicly for rooves.house" dig rooves.house NS +short +time=3 +tries=1 @1.1.1.1 section "Ping test" ping -c 2 -t 3 "$NAME" 2>&1 | tail -3 } > "$OUT" 2>&1 echo "Done. Results in $(pwd)/$OUT"