For a glibc resolver, wait two seconds per DNS attempt and try three times.
Choose the options line for /etc/resolv.conf.
Which line is appropriate?
glibc-style resolv.conf uses options timeout:2 attempts:3 to set wait time and retry count.
Detailed explanation
timeout 2 attempts 3Incorrect. It lacks the options directive and colon syntax.
nameserver timeout:2 attempts:3Incorrect. nameserver is for resolver addresses.
options timeout:2 attempts:3Correct. It sets the requested timeout and attempts values.
search timeout=2 attempts=3Incorrect. search is for domain suffixes and does not use this syntax.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'options timeout:2 attempts:3' | awk '{print $1, $2, $3}'Expected result
options timeout:2 attempts:3Key points
- Use the options line
- timeout is seconds
- attempts is retry count
Notes
- Environment: POSIX awk / 一時標準入力のみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Resolver options
A group of directives that controls DNS query behavior.
Timeout
The period a resolver waits for a response before retrying or failing.
Attempts
The number of retries made when a DNS response is not received.