220-1102 Question 271
Single answer/etc/hostsA Linux workstation in a small office can reach websites by IP address, but users report that the internal site intranet.local opens the wrong server. DNS records were recently changed, but this one workstation still resolves intranet.local to an old IP address even after rebooting. You check the system and find an entry for intranet.local in /etc/hosts. Which action should the technician take FIRST to correct name resolution on this workstation?
- A
Edit /etc/hosts to remove or correct the intranet.local entry, then test name resolution again
- B
Restart the DNS server so the workstation will stop using the old record
- C
Run chmod +x /etc/hosts so the system can read the updated host mapping
- D
Delete /etc/resolv.conf because /etc/hosts should contain all hostname mappings
Show answer and explanation
Correct answer: A
Explanation
The key troubleshooting point is that /etc/hosts provides local hostname-to-IP mappings and can override DNS results for that system. In a real support scenario, if one Linux workstation resolves a hostname differently from others, checking /etc/hosts is a best practice. The proper first action is to edit or remove the incorrect entry and retest. This aligns with standard Linux administration practices documented in the hosts(5) manual page, which describes /etc/hosts as a static table lookup for hostnames. Depending on the distribution and configuration in /etc/nsswitch.conf, the hosts file is often consulted before DNS, which explains why this workstation continues using the outdated IP even after the DNS record was changed.
- A. Correct.
Correct. On Linux, /etc/hosts is a local static hostname mapping file that is commonly checked before or alongside DNS based on the system's name service configuration. If intranet.local is explicitly mapped to the old IP in /etc/hosts, that local entry will override the desired DNS result for that workstation. Removing or correcting the entry is the most direct first step.
- B. Incorrect.
Incorrect. Restarting the DNS server would not fix a stale local mapping in /etc/hosts on a single workstation. This option reflects a common misconception that all name resolution issues are DNS-server problems, when in this case the problem is caused by a local configuration override.
- C. Incorrect.
Incorrect. /etc/hosts does not need execute permissions. It is a text file that the system reads; making it executable is unnecessary and does not affect hostname resolution. The relevant concern is the file's contents, not whether it can be run as a program.
- D. Incorrect.
Incorrect. /etc/resolv.conf is used to define DNS resolvers and related lookup settings, not to replace /etc/hosts. Deleting it would likely create additional DNS resolution problems. A technician should not remove resolv.conf simply because a hosts file entry exists.