MacOS – No DNS resolution if custom configured DNS server is not reachable – how to fallback to default DNS

dnsmacos

How can I configure the DNS server in the network preferences with 8.8.8.8 (Google DNS) for my Mac but have it default to local network DNS servers in case Google's DNS server is not reachable from a LAN?

Best Answer

First go to the terminal to find out what's your current DNSs using the command:

cat /etc/resolv.conf | grep nameserver

Then,

in your network settings, under "Advanced"

enter image description here

enter:

8.8.8.8
8.8.4.4
x.x.x.x //local DNS
x.x.x.x //local DNS

If Google DNS won't work it will fallback to google other DNS server. If that fails too the fallback will be your local DNSs.