1

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.

  1. Do I correctly understand that '1 attempt' in fact means 'make a request and then re-request after timeout'?

  2. Is there a way to change this behaviour so the system would send only one DNS request in scope of 1 attempt?

Thanks

1 Answer 1

1

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 for A record, which is the normal behavior. If so, try adding inet6:off in options Also, probably trivial, but verify the number of nameserver items you have. The timeout is for each of them sequentially.

4
  • 1
    inet6:off terrible advice Nov 25, 2017 at 7:16
  • Yes, this is only to debug the reason for the two queries. Nov 25, 2017 at 9:23
  • 1
    Or run tcpdump? Nov 25, 2017 at 15:12
  • Hello guys, thanks for the answers. By 'DNS request' I mean both A and AAAA type of queries. So in fact I observe in traces 'A request, AAA reguest, timeout, A request, AAAA request, timeout'. So both types of queries are duplicated.
    – Maxim
    Nov 27, 2017 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.