System Management

An administrator adds the line 10.0.0.25 build01 to /etc/hosts on a server whose /etc/nsswitch.conf lists files before dns for hosts. What must be done before lookups of build01 return the new address?

Show the answer

Correct answerA. Nothing more, because the resolver reads /etc/hosts on each lookup

AWhy this is right: glibc reads /etc/hosts on every lookup through the files source, so the saved edit applies at once.

BWhy not this: NetworkManager does not serve lookups from /etc/hosts; the resolver library reads the file directly.

CWhy not this: hostnamectl sets the machine's own hostname; it does not register entries for other hosts.

DWhy not this: glibc keeps no boot-time copy of /etc/hosts, so no reboot is needed.

The resolver library reads /etc/hosts each time a lookup uses the files source, so a saved edit applies at once. The tempting belief that a service restart or reboot is needed applies to DNS client configuration managed by other tools, not to this plain-text file.