resolverが問い合わせるDNS serverとして192.0.2.53を指定する。
/etc/resolv.confへ記述する。
適切な行はどれか。
/etc/resolv.confではnameserverの後へDNS serverのIPv4またはIPv6 addressを記述する。
詳細解説
nameserver 192.0.2.53nameserver directiveへDNS serverのIP addressを指定する。
正しい。nameserverの後へ192.0.2.53を置くと、resolverの問い合わせ先として扱われる。
server=192.0.2.53resolv.confのnameserver directive構文ではない。
誤り。server=は別softwareで見られる形式で、glibc resolverがnameserverとして読む行ではない。
search 192.0.2.53searchは短い名前へ補うdomain suffixを指定する。
誤り。searchの値はdomain suffixであり、DNS server addressを置くdirectiveではない。
hosts 192.0.2.53hostsというresolv.conf directiveでDNS serverは指定しない。
誤り。resolv.confにhosts directiveで問い合わせ先を設定する標準構文はない。
実際に確かめる
一時的な検証環境で実行できる例です。
printf '%s
' 'nameserver 192.0.2.53' | cut -d' ' -f1,2期待される結果
nameserver 192.0.2.53理解のポイント
- nameserver directive
- IP addressを指定
- searchとは用途が異なる
確認時の注意
- 確認環境: POSIX awkによるdirective確認
- 実際の/etc/resolv.confは変更しない。
基礎のおさらい
stub resolver
applicationのresolver APIはresolv.conf等の設定から問い合わせ先や検索domainを得る。
自動生成
NetworkManagerやsystemd-resolved等がresolv.confを生成・link管理するhostでは、管理元のprofileを変更する。