nsswitch.conf の設定(hosts行)に従って、ホスト名 www.example.com の名前解決結果を確認するコマンドはどれか。

LPIC-1(101/102 試験)「ネットワークの基礎」の練習問題。正解と選択肢ごとの個別解説つきで、過去問対策・例題演習に。

LPIC-1 / ネットワークの基礎 ・ コマンド問題
$
  1. getent hosts www.example.com✓ 正解
  2. ip neigh show www.example.com
  3. ss -tuln www.example.com
  4. arp -a www.example.com
💡 getent hosts は nsswitch.conf の hosts 行(files→dns 等の参照順)に従って名前解決し、結果を表示します。host/dig はDNSに直接問い合わせるため /etc/hosts は考慮しません。
○ getent hosts www.example.com:正解。getent hosts は nsswitch.conf の参照順(files→dns 等)に従って名前解決します。
✕ ip neigh show www.example.com:ip neigh はARP/近傍キャッシュの表示で、名前解決の確認用ではありません。
✕ ss -tuln www.example.com:ss はソケット状態の表示で、ホスト名の名前解決は行いません。
✕ arp -a www.example.com:arp -a はARPキャッシュの表示で、nsswitch経由の名前解決確認ではありません。
▶ この分野をクイズ形式で解く