Split DNS for macOS

Andrew Fried afried at spamteq.com
Wed Nov 3 21:34:27 UTC 2021

Hi Matty,

I understand exactly what you're trying to accomplish and agree that 
split dns can be challenging, especially with multiple VPN gateways.

My point is that what you're describing is a DNS issue, not a 
firewall/vpn/routing issue.  As such, I think there's more eloquent way 
to solve DNS related issues.

The old fashioned way is to add exceptions to the equivalent of the 
/etc/host file.  Not ideal, doesn't scale well and pretty static, but if 
you're relying on just a few private host mappings it works pretty well.

The second and more palatable solution is to have the internal 
nameservers running software that supports views - such that queries for 
xxxx.example.com that originate from private address space return 
different answers than if the query originated from public space.

A third option would be set the internal recursives up as forwarders 
that only respond authoritatively for your private "mydomain.internet" 
and forward all other requests to nameservers capable of public recursion.

There's the dnsdist solution, which is an advanced dns proxy server 
capable of routing requests to different recursives based on the domain 
name.  DNSDIST does a lot of other stuff as well, but the heart of is 
intelligent proxying.  In our racks we use DNSDIST to distribute around 
a million DNS queries per minute and it works flawlessly.

Basically, what I'm suggesting is that DNS servers handle DNS and 
wireguard handle routing/transport.  Adding VPN functionality to a 
nameserver or dns capabilities to Wireguard adds complexities that can 
be better handled elsewhere.

What makes Wireguard so good is that it does one thing and does it 
really, really well.


On 10/29/21 5:06 PM, Matty Driessen wrote:
> Hello Andrew,
> I just want to chime in here and say that I think the current
> implementation of search domains is simply not working the way it
> should on the MacOS client.
> My use case is pretty common, an internal DNS server that has entries
> for internal servers. I defined a search domain in the WireGuard
> configuration; DNS = mydomain.internal. The search domain
> is for convenience, so I can just use the servername instead of
> servername.mydomain.internal. Now this works fine when I route all the
> traffic through the VPN (AllowedIPs = but the search domain
> is completely ignored when I only route the traffic I need to
> (AllowedIPs =
> I don't think this is a configuration error on my side. The DNS
> responds fine when using servername.mydomain.internal. This problem is
> even mentioned in the "WireGuard macOS & iOS TODO List"
> 9. matchDomains=[“”] doesn’t do what the documentation says.
> Specifically, DNS servers are not used if allowed IPs isn’t
> The description isn't 100% accurate (or outdated), the DNS server is
> used but the search domain isn't being set on the primary resolver.
> Some have solved this issue by adding the search domains to the list
> of matchDomains; dnsSettings.matchDomains = [""] +
> dnsSettings.searchDomains. But that way the DNS server specified in
> WireGuard is still the primary resolver for all DNS queries.
> Here is a link on how OpenVPN handles this and I think it's how it
> should work when not using AllowedIPs
> https://openvpn.net/faq/how-does-ios-interpret-pushed-dns-servers-and-search-domains/
> On a split-tunnel, where redirect-gateway is not pushed by the server,
> and at least one pushed DNS server is present:
> - route all DNS requests through pushed DNS server(s) if no added
> search domains.
> - route DNS requests for added search domains only, if at least one
> added search domain.
> Yours sincerely,
> Matty
> --
> Hi Stephen,
> A better solution to your problem would be to deploy DNSDIST:
>          https://dnsdist.org/
> I for one would hope that esoteric requests that address a solution
> for less than 1% of the users would be rejected with the overall goal
> of preventing feature creep and bloat.
> Andrew

Andrew Fried
afried at spamteq.com
+1.703.667.4050 Office
+1.703.362.0067 Mobile

More information about the WireGuard mailing list