Split DNS for macOS

Stephen Larew stephen at slarew.net
Thu Oct 28 07:16:37 UTC 2021

For many months now, I have been running a patched WireGuard macOS app
that enables a split DNS configuration. I would like to try to upstream
my patches for split DNS.

There has been some interest in this patch:
- "Mac APP DNS Search Domain" thread from July and August 2021 [1]
- A commenter on my GitHub fork of wireguard-apple.

What is split DNS? It allows sending DNS queries to a specific server
based on the domain name. Systemd-resolved calls it a routing domain.
Apple's Network Extension framework calls it a match domain.  Split DNS
is especially useful for internal DNS servers.

For example, if corp.example.com is a routing domain for the DNS server
at (only accessible over WireGuard), then
server.corp.example.com is resolved using while
www.example.com is resolved using some other DNS resolver (depending on
the other network settings in macOS).

The proposed patch adds new syntax to the wg-quick DNS= line.
Specifically, a tilde prefixed domain is treated as a routing domain.
Multiple routing domains can be added.

- Needs modifications to iOS UI to work on iOS.
- Only matching routing domains are sent to the DNS servers specified in
  the DNS= config line.  No separate fallback catch-all DNS server can
  be set.
- Routing/match domains are also included in the list of search domains.
  This could be changed with the matchDomainsNoSearch API, but lacking
  more UI or config file changes to expose this option to the user, I
  went with the default.

[1] https://lore.kernel.org/wireguard/20210810074232.aah5ktq5yzysaaey@SvensMacBookAir-2.local/T/
[2] https://github.com/slarew/wireguard-apple/commit/6ebc356d9e11ab91443e06de5e89f1af57fcdff8

More information about the WireGuard mailing list