Question 480
A Linux administrator faces this requirement: A local application must resolve a special test hostname to a fixed IP before public DNS lookup according to host resolution policy. Which specific action is the best direct solution?
Explanation
Correct Answer
Add the entry in /etc/hosts and confirm the hosts source precedes DNS in nsswitch.conf. The mechanism is: The hosts database provides explicit local name-to-address mappings consulted by the resolver per NSS order.
Incorrect Answers
Set ipv4.dns on the appropriate NetworkManager connection profile and reactivate it. That operation is designed for the different case: A corporate client must send DNS queries to a new resolver persistently under NetworkManager. It does not perform the specific action required here: Add the entry in /etc/hosts and confirm the hosts source precedes DNS in nsswitch.conf.
Use hostnamectl set-hostname newname on a systemd host. That operation is designed for the different case: The system's static hostname must survive reboot and be reported consistently to utilities. It does not perform the specific action required here: Add the entry in /etc/hosts and confirm the hosts source precedes DNS in nsswitch.conf.
Ensure the hosts line in /etc/nsswitch.conf orders files before dns as appropriate. That operation is designed for the different case: A host must consult local files before DNS for resolving service hostnames. It does not perform the specific action required here: Add the entry in /etc/hosts and confirm the hosts source precedes DNS in nsswitch.conf.






LPI Level 1 (102-500) Practice Tests