Auto-switch DNS based on SSID - iPhone + Mac OS

On the iPhone if you go into WiFi settings you can select the ‘i’ on the right end of any network SSID and set ‘Configure DNS’ to ‘Manual’ and then enter your own DNS. This will stick to that SSID only. Very useful when you have a Raspberry Pi at home running pi-hole, but your router settings are locked down.

But there is no way to do this easily on the Mac. Unless - you have Keyboard Maestro! I found this really great setup on StackExchange from @tjluoma

How to autoswitch DNS settings while connected to a different WiFi

I set it up, then duplicated it and added a new macro that changed the network location to ‘automatic’ when my home SSID disconnects. That way at home (my RV) my Pi w/ pi-hole is always set to be the DNS (using Cloudflare as the upstream DNS), but for any other network (RV park, coffee shop) the DNS is set to Cloudflare (1.1.1.1).

So, I am a very happy camper. Thanks TJ!

3 Likes

I also have a Raspberry PI/PI-hole setup at home. I’m using automatic DNS configuration on all my devices.

My router is still the DHCP server and gives the network parameters to the clients. In my router I have the IP-number of my PI-hole as the DNS server an that works fine.