wireguard.lists.zx2c4.com archive mirror
 help / color / mirror / Atom feed
From: Andrew Fried <afried@spamteq.com>
To: wireguard@lists.zx2c4.com
Subject: Re: Split DNS for macOS
Date: Wed, 3 Nov 2021 21:34:27 +0000	[thread overview]
Message-ID: <K17663-81.1635975267@spamhaus.org> (raw)
In-Reply-To: <CAHsVW7N2JA25KXDRM0ghNrn-9BZpuqY0OMHX4WTi7hmXjS9nGA@mail.gmail.com>

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.

Andrew


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 = 10.13.13.1 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 = 0.0.0.0/0) but the search domain
> is completely ignored when I only route the traffic I need to
> (AllowedIPs = 10.13.13.0/24 192.168.0.0/24).
> 
> 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 0.0.0.0/0.
> 
> 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 0.0.0.0/0.
> 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@spamteq.com
+1.703.667.4050 Office
+1.703.362.0067 Mobile

  reply	other threads:[~2021-11-03 21:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29 21:06 Split DNS for macOS Matty Driessen
2021-11-03 21:34 ` Andrew Fried [this message]
2021-11-03 21:46   ` Alex Burke
  -- strict thread matches above, loose matches on Subject: below --
2021-10-28  7:16 Stephen Larew
2021-10-28  9:58 ` Bruce Ferrell
2021-10-29 15:33   ` Stephen Larew
2021-10-29 17:03     ` Andrew Fried
2021-10-29 21:07       ` Stephen Larew
2021-10-30 21:00         ` Dusan Zivadinovic
2021-11-03  9:15         ` Harald Dunkel
2021-11-03  9:42           ` Matty Driessen
2021-11-03 11:54         ` Alex Burke
2021-11-06  4:54         ` David Anderson
2021-11-06  9:47           ` Matty Driessen
2022-01-28  5:23 ` Stephen Larew
2022-01-28  9:02   ` Harald Dunkel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=K17663-81.1635975267@spamhaus.org \
    --to=afried@spamteq.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).