Question 480
A lab machine must resolve a specified internal hostname to a fixed address without querying DNS. One student proposes Add the mapping to /etc/hosts with appropriate privileges and another proposes Run host example.org. Which technical comparison is the soundest?
Explanation
Correct Answer
Correct distinction: Add the mapping to /etc/hosts with appropriate privileges targets local hostname override; The hosts file provides local static hostname-to-address mappings in normal name-service configurations. The compared alternative instead serves DNS record lookup.
Incorrect Answers
Incorrect mapping: Run host example.org is used for DNS record lookup. It does not displace Add the mapping to /etc/hosts with appropriate privileges for the described requirement.
The mechanisms are different: The hosts file provides local static hostname-to-address mappings in normal name-service configurations. By contrast, host performs DNS lookups and displays the returned resource records. They are not universally interchangeable.
The third option addresses listening TCP sockets: ss lists TCP sockets and -l restricts the display to listening sockets. The original action remains relevant because The hosts file provides local static hostname-to-address mappings in normal name-service configurations.