CompTIA Server+ guideStudy & preparation
CompTIA Server+ Hostname Troubleshooting: DNS, Hosts Files and Evidence
Short answer
A DNS query can return the intended address while a Linux client uses a different address from an earlier Name Service Switch source. The Linux nsswitch.conf manual documents source ordering: with hosts: files dns, a matching local hosts entry is consulted before DNS. Compare DNS evidence with an NSS lookup, then confirm the client's resolution path and intended mapping before changing anything.
What does a correct DNS query actually prove?
A correct DNS answer does not prove that a Linux application selected that address: the BIND manual describes dig as a DNS-query tool, while the Linux nsswitch.conf manual documents an ordered choice of name-service sources. A client using that Name Service Switch (NSS) configuration can select a matching local hosts entry before consulting DNS.
Treat the successful query as one observation. Record the exact hostname and the address returned, then compare it with the lookup path used on the affected machine. Avoid changing a DNS record simply because a service still fails by name.
CompTIA's SK0-005 objective 4.5 includes hostname-related failures, a misconfigured hosts file, and dig. The Server+ exam-content guide places those tasks in the broader objectives. This guide uses a Linux implementation to practice that distinction; it does not claim every server application resolves names identically. Objective 4.5 is part of Troubleshooting, the second-largest domain in the CompTIA Server+ prep planned for launch.
How can local source order change the answer?
The hosts database entry in /etc/nsswitch.conf controls the sources consulted by clients using that NSS configuration. The documented example is:
hosts: files dns
Here, the local hosts source comes before DNS. A matching entry in /etc/hosts can therefore explain why the local lookup selects an address different from the DNS answer. Read the actual configuration before applying this explanation: not every Linux system has that source order, and not every application follows NSS.
Separate three questions in your notes:
- Which mapping is intended? Confirm the address the service owner or lab specification expects for the exact name.
- Which mapping does each lookup return? Keep the DNS and local lookup observations separate.
- Which source can explain the difference? Inspect the configured order and matching local entry before proposing a correction.
A discrepancy is evidence to investigate, not automatic proof that a hosts entry is stale. An intentional local override could be the correct mapping for the stated task. Deleting it before establishing intent would remove evidence and could select an unwanted address.
How do dig and getent provide different evidence?
The Linux getent manual says the command queries databases supported by NSS. A keyed lookup such as getent hosts reports.training.example asks for a matching entry in the hosts database using that configuration.
| Observation | What it supports | What it leaves open |
|---|---|---|
dig returns an address | A DNS-query result for the name | Whether the affected application uses that result |
getent hosts returns an address | A result through the configured NSS hosts database | Whether the application follows the same lookup path |
| The two addresses differ | The two observations need a source-path comparison | Which mapping is intended and which source caused the difference |
| The two addresses agree | No difference appears in those two observations | Whether the original application task now works |
Use both checks on the affected Linux system and record the same exact name. The output is not a substitute for confirming the application's resolver behavior. For a standard NSS client, the comparison is relevant evidence; for a client using another path, document that path before drawing a conclusion.
The getent manual distinguishes a successful command, exit status 0, from a supplied key not found, exit status 2. A missing result should remain a separate observation, rather than being rewritten in your notes as “DNS is broken.” The CompTIA Server+ prep planned for launch explains every answer option, which helps you check that you read evidence like this correctly.
How do you trace conflicting addresses without guessing?
The following transcript and cases are invented teaching examples, not executed commands or recalled exam questions. All names and addresses are illustrative, and output is abbreviated rather than a promise of exact columns or ordering. Assume the affected client uses standard NSS resolution.
$ dig reports.training.example
[DNS answer excerpt: 192.0.2.80]
$ getent hosts reports.training.example
192.0.2.40 reports.training.example
Observed configuration excerpt:
hosts: files dns
Observed /etc/hosts entry:
192.0.2.40 reports.training.example
Case A: the earlier source explains the difference. The lab specification identifies 192.0.2.80 as the intended destination. The local entry matches the name, NSS checks files first, and the NSS result matches that entry. This evidence supports correcting the identified local mapping through the applicable change process. It does not support changing DNS merely to match the unwanted local result.
Case B: the local mapping is intentional. Keep the same observations, but the service owner confirms that this machine must use 192.0.2.40. The differing results are then consistent with the intended local override. Investigate the reported failure without deleting the entry just to make the two checks agree.
Case C: the expected local explanation is absent. The two results differ, but inspection finds no matching hosts entry. You have a discrepancy without the evidence needed for Case A's conclusion. Record the actual NSS configuration and confirm how the affected client resolves the name; do not invent an unseen stale entry.
If the task instead concerns which clients can reach a virtual server, the Server+ virtual-network-mode guide addresses that separate decision.
What should you validate after correcting the identified source?
Use this editorial record to keep the correction tied to its evidence:
- Expected mapping: Exact name, intended address, and who or what establishes it.
- Before: DNS result, NSS result, actual source order, and relevant local entry.
- Action: The confirmed source changed, with the previous setting recorded.
- After: Repeated lookup results and the outcome of the original application task.
- Conclusion: Resolved, unchanged, or still uncertain, with the next evidence needed.
CompTIA's SK0-005 troubleshooting guidance calls for one change at a time followed by verification, and reversing an unsuccessful change where appropriate. The Server+ troubleshooting-decisions guide develops that change-and-test record.
If the lookup now returns the intended address but the original task still fails, keep the investigation open. For study practice, explain the evidence behind the networking answers in the 20 free Server+ questions, then schedule another comparison exercise with the free Server+ study plan. Start by writing why Case B should not receive Case A's correction. After that, practice by domain, one at a time or mixed, is planned for full CompTIA Server+ prep.
Trust the source
Official sources
Exam policies can change. Use these primary sources for the most current details.