Courseiva
Network Client ManagementhardMultiple ChoiceObjective-mapped

LPIC-2 Network Client Management Practice Question

Which command can be used to test the entire name resolution order as defined in nsswitch.conf?

⚠ Common exam trap

Many exam-takers choose `dig` or `host` because they are familiar DNS tools, but they fail to realize that these commands bypass the NSS configuration and only test DNS, not the full resolution order including local files or other sources like `myhostname`.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

getent hosts

The `getent hosts` command queries the system's Name Service Switch (NSS) configured sources in the exact order defined in `/etc/nsswitch.conf`. It uses the `gethostbyname()` or `getaddrinfo()` library calls, which respect the `hosts:` line in nsswitch.conf (e.g., `files dns myhostname`), testing resolution through each source sequentially until a result is found or all sources are exhausted.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • host

    Why it's wrong here

    Queries DNS directly.

  • getent hosts

    Why this is correct

    Tests resolution via nsswitch.

  • nslookup

    Why it's wrong here

    Queries DNS directly.

  • dig

    Why it's wrong here

    Queries DNS directly, ignores nsswitch.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

This LPIC-2 question is part of Courseiva's 507-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LPIC-2 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-2 exam.