Open ghost opened 1 year ago
@fkooman: The hostnames in the DNS field in the wg-quick config are search domains, not match domains.
man wg-quick says:
DNS — a comma-separated list of IP (v4 or v6) addresses to be set as the interface's DNS servers, or non-IP hostnames to be set as the interface's DNS search domains.
To clarify search domains vs match domains: If we seat search domains as ["example.com"], it means that if we need to resolve "abc", the resolver should try to resolve "abc.example.com" first; If we set match domains as ["example.com"], it means only "example.com" and "*.example.com" queries should go to this resolver.
WireGuardKit (see PacketTunnelSettingsGenerator.swift) sets the wg-quick DNS hostnames as search domains, consistent with the man page. It sets match domains as [""], which makes all queries go through the tunnel's DNS resolver first. I don't think there's a way to specify match domains in a wg-quick config.
Interesting! That makes a lot of sense.
I don't think there's a way to specify match domains in a wg-quick config.
Is this something that should be added (upstream)? It seems like an important feature to have so you are not leaking your DNS queries to all configured DNS servers?
Scenario:
In the client configuration file, you can configure this like this:
This means that all DNS queries that are for the
*.example.org
or*.example.com
domain MUST go to the192.168.1.5
DNS server. All queries for other domains should go to the DNS resolver that was configured on the system before the VPN got up, i.e. the one provided by WiFi network or ethernet. On macOS all queries go to the192.168.1.5
server once connected, and not to the "system" DNS any longer.On Linux (NetworkManager) it works exactly like it should. On Windows, a query is sent to all DNS servers, which is technically not correct, but at least it works.
This is most likely an upstream WireGuard issue that should also be fixed there...
It seems
scutil --dns
shows it as being correctly configured.