How to enable DoH on macOS, but only when 1.1.1.1 is set as DNS server

I’m trying to enable DNS-over-HTTPS on macOS Sierra. However, I have a few different Locations (sets of network settings) set up, which vary in which DNS server they use. (I often visit a local university whose Wi-Fi will only let me connect if I let them set the DNS.)

As such, I’d like DNS-over-HTTPS on when 1.1.1.1 is the active DNS server, and off otherwise. Is there a way I can set this up?

DoH isn’t a first-party feature of MacOS, so you’ll need something like this:

But I don’t think either client supports reading the existing settings and only using DoH when they’re set to 1.1.1.1.

It’s worth noting that Chrome, starting with v78, will use DNS over HTTPS and will only use it when your DNS resolver is already set to Cloudflare: How to enable DNS over HTTPS in Chrome - #9 by Judge

1 Like