-
-
Notifications
You must be signed in to change notification settings - Fork 145
Description
In version 1.2.0, LookupClient stops querying any other server in case the response was valid.
Valid responses are any responses without an error code. (Error responses might be retried, depending on configuration...)
But a no-error response might have zero answers, which can have many reasons.
It is very likely that every DNS server in your network will return the same empty response, but there are some network configurations where DnsClient will auto-resolve servers from multiple network adapters which might not return the same result.
So, it might make sense to try the other servers anyways.
Starting with version 1.3.0 of DnsClient, LookupClient will now try to find an answer from all configured DNS servers (per default).
The logic here is relatively simple:
- If the question is answered, return the response, as usual.
- If no other servers are available, return the empty response
- If there are other servers
- and no answers are in the response, try the next server
- and there are answers in the response but they are not matching the question, try the next server.
(this part is ignored if the question is eitherANYorAXFR)
The behavior can be disabled with a new setting called ContinueOnEmptyResponse.
I don't think this will change anything for most use-cases, as most setups usually just resolve one NameServer anyways, like in most VMs or containers.
Example
dotnet run -f netcoreapp3.1 --time 10000 --tries 0 -s 192.168.0.2 -s 8.8.8.8 -s 8.8.4.4 abc
Log output
DnsClient Verbose: 1 : [LookupClient] Begin query [59669 - Qs: 1 Recursion: True OpCode: Query] via UDP => abc IN A on [8.8.4.4:53, 192.168.0.2:53, 8.8.8.8:53].
DnsClient Verbose: 2 : [LookupClient] TryResolve 59669 via UDP => abc IN A on 8.8.4.4:53, try 1/1.
DnsClient Verbose: 10 : [LookupClient] Got 0 answers for query 59669 via UDP => abc IN A from 8.8.4.4:53.
DnsClient Information: 12 : [LookupClient] Got no answer for query 59669 via UDP => abc IN A from 8.8.4.4:53. Trying next server.
DnsClient Verbose: 2 : [LookupClient] TryResolve 4589 via UDP => abc IN A on 192.168.0.2:53, try 1/1.
DnsClient Verbose: 10 : [LookupClient] Got 0 answers for query 4589 via UDP => abc IN A from 192.168.0.2:53.
DnsClient Information: 12 : [LookupClient] Got no answer for query 4589 via UDP => abc IN A from 192.168.0.2:53. Trying next server.
DnsClient Verbose: 2 : [LookupClient] TryResolve 16265 via UDP => abc IN A on 8.8.8.8:53, try 1/1.
DnsClient Verbose: 10 : [LookupClient] Got 0 answers for query 16265 via UDP => abc IN A from 8.8.8.8:53.
Result
; <<>> MiniDiG 1.0.0.0 Microsoft Windows 10.0.18363 <<>> --time 10000 --tries 0 -s 192.168.0.2 -s 8.8.8.8 -s 8.8.4.4 abc
; Servers: 192.168.0.2:53, 8.8.8.8:53, 8.8.4.4:53
...
; (3 server found)
;; Got answer:
;; ->>HEADER<<- opcode: Query, status: No Error, id: 53991
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512; code: NoError
;; QUESTION SECTION:
abc. IN A
;; AUTHORITIES SECTION:
abc. 92 IN SOA ac1.nstld.com. info.verisign-grs.com. 1584144303 1800 900 604800 86400
;; Query time: 24 msec
;; SERVER: 8.8.8.8#53
;; WHEN: Sat Mar 14 00:33:53 Z 2020
;; MSG SIZE rcvd: 99