When I'm connected to a VPN (WireGuard) it sets a DNS server for the VPN interface, and blocks requests to outside DNS servers. This is what I want, and what many VPNs do, and it works fine with other applications (nslookup, browsers, etc.) because they use the OS's DNS resolution, which tries the DNS servers in order of priority, and the VPN DNS server has the highest priority. DnsClient.NET, however, gets the DNS servers from all my network interfaces, and tries them in random order by default, so depending on my luck, I get from 0 to 4 timeouts before it tries the one working DNS server. Sometimes DNS resolution times out entirely because of this!
Setting LookupClientOptions.UseRandomNameServer = false disables this, but I cannot do this when LookupClient is used internally by another library, such as the MongoDB driver.
Please make UseRandomNameServer = false the default - honoring network interface priority order is the behavior most users would expect, since it's what the OS does. This is such a gotcha!
When I'm connected to a VPN (WireGuard) it sets a DNS server for the VPN interface, and blocks requests to outside DNS servers. This is what I want, and what many VPNs do, and it works fine with other applications (nslookup, browsers, etc.) because they use the OS's DNS resolution, which tries the DNS servers in order of priority, and the VPN DNS server has the highest priority. DnsClient.NET, however, gets the DNS servers from all my network interfaces, and tries them in random order by default, so depending on my luck, I get from 0 to 4 timeouts before it tries the one working DNS server. Sometimes DNS resolution times out entirely because of this!
Setting LookupClientOptions.UseRandomNameServer = false disables this, but I cannot do this when LookupClient is used internally by another library, such as the MongoDB driver.
Please make UseRandomNameServer = false the default - honoring network interface priority order is the behavior most users would expect, since it's what the OS does. This is such a gotcha!