System Management
A server has the line "10.1.1.5 app.example.com" in /etc/hosts, while DNS returns 10.1.1.9 for the same name. The hosts entry in /etc/nsswitch.conf reads "hosts: dns files". Which address does the command getent hosts app.example.com return?
Show the answer
Correct answerC. 10.1.1.9, because dns is listed before files and answers the query
The hosts line in /etc/nsswitch.conf sets the source order, and lookup stops at the first source that returns an answer. Here dns is first, so 10.1.1.9 is returned. The belief that /etc/hosts always wins is only true when files is listed first, as in the common default.