Skip to content

Avoid overriding global DNS options on Windows, use fine-grained options instead #1111

@BobVul

Description

@BobVul

After #1022 the DNS behaviour of netclient on Windows is currently:

  1. DNS server is set on the netmaker interface, potentially making all DNS requests go to that server (depending on interface metric).
  2. SearchList is set on the netmaker interface, adding the netmaker suffix to the pool of suffixes Windows will search.
  3. SearchList is set in the global settings, forcing the netmaker suffix to be the only searchable suffix, overriding any interface-specific options.

Of this set, 3 is a problem because as per Microsoft:

When a domain suffix search list is configured on a client, only that list is used. The primary DNS suffix and any connection-specific DNS suffixes are not used, nor is the devolution of the primary suffix attempted. The domain suffix search list is an administrative override of all standard Domain Name Resolver (DNR) look-up mechanisms.

By setting the global SearchList, Windows will no longer consider DNS suffixes provided by interfaces. This prevents proper DNS lookup on non-netmaker interfaces, e.g. one assigned by DHCP option 15.

Instead I believe the approach taken by OpenVPN would be appropriate here:

If a SearchList is present in the registry already, the domains are added to that list. Otherwise the domains are added to the VPN interface specific list. A group policy search list takes precedence over a system-wide list, and that one itself takes precedence over interface specific ones.

i.e. the global SearchList is only changed if one already exists. In this case OpenVPN does not appear to also add to the interface list but it probably does not hurt.

Specifically, running the PowerShell command Get-DnsClientGlobalSetting should never return a SuffixSearchList with only the netmaker suffix.


Additionally, by setting the DNS server on the netmaker interface directly, it becomes a candidate for all DNS resolution determined only by the interface metric. Generally it's undesirable that non-netmaker queries end up going to the netmaker DNS server, so instead an NRPT rule should be used to only apply the netmaker DNS server to the netmaker suffix.


Ideally, the full set of DNS resolution should look something like this:

  1. DNS server is set via NRPT rule only, so only queries intended for netmaker actually go to its DNS server. This means the DNS server should not be set on the interface.
  2. SearchList is set on the netmaker interface only, which adds it to the suffix pool without affecting other interfaces.
  3. Only if SearchList is already set in the global settings, append the netmaker suffix to the list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions