I'd like Linux to make only one request to DNS server, wait for 5 sec timeout and then abort the lookup if no answer.
To do this I set the following options in /etc/resolv.conf
assuming that attempts
element in options
means the exact number of DNS requests:
nameserver 'DNS Server IP address'
domain 'Domain Name'
options attempts:1 timeout:5
But the system behaves unexpectedly. In fact for these settings I observe:
DNS request
Wait for a 5 sec timeout
DNS request repeat
Wait for a 5 sec timeout
If I set attempts:2, there will be 4 requests.
-
Do I correctly understand that '1 attempt' in fact means 'make a request and then re-request after timeout'?
-
Is there a way to change this behaviour so the system would send only one DNS request in scope of 1 attempt?
Thanks
Best Answer
Your interpretation looks correct to me.
Did you check what these two queries are? Maybe the first one is for
AAAA
record and second one is forA
record, which is the normal behavior. If so, try addinginet6:off
inoptions
Also, probably trivial, but verify the number ofnameserver
items you have. The timeout is for each of them sequentially.