Set the local domain to example.test as the only search candidate.
Use the domain directive in /etc/resolv.conf.
Which line is appropriate?
domain DOMAIN sets one local domain. Use search when multiple suffix candidates must be tried.
Detailed explanation
domain=example.testIncorrect. The domain directive uses whitespace, not equals.
domain example.testCorrect. It sets the single local domain.
hosts: example.testIncorrect. hosts sources belong to nsswitch.conf.
options domain:example.testIncorrect. domain is a separate resolv.conf directive, not an options value.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'domain example.test' | awk '{print $1, $2}'Expected result
domain example.testKey points
- domain is one candidate
- search supports multiple
- Different from nameserver
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
domain directive
A resolver setting that supplies one default domain for short names.
Search list
A resolver setting that supplies multiple domains and tries them in order.
/etc/resolv.conf
The local file that stores resolver directives such as domain and nameserver.