Courseiva
Network Client ManagementmediumMultiple ChoiceObjective-mapped

LPIC-2 Network Client Management Practice Question

A Linux client is experiencing slow name resolution. The /etc/nsswitch.conf file has the line 'hosts: files dns'. The /etc/hosts file contains many entries. What is the most effective way to improve resolution speed?

⚠ Common exam trap

A common mix-up: candidates assume removing entries from /etc/hosts or adding a caching daemon will fix the speed issue, when the real problem is the lookup order in nsswitch.conf, which directly controls whether the resolver checks a potentially large local file before querying DNS.

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

Change the nsswitch.conf line to 'hosts: dns files'

The current order 'hosts: files dns' causes the resolver to check the entire /etc/hosts file first for every query, which is slow when the file contains many entries. Reversing the order to 'hosts: dns files' makes the resolver query DNS first, which is typically faster for most lookups, and only falls back to the local file if DNS fails. This directly addresses the bottleneck without requiring additional services or data removal.

Answer analysis

Option-by-option breakdown

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

  • Increase the DNS timeout in /etc/resolv.conf

    Why it's wrong here

    Increasing timeout would make resolution slower, not faster.

  • Change the nsswitch.conf line to 'hosts: dns files'

    Why this is correct

    Checking DNS first avoids reading the large hosts file for most queries, improving resolution speed for external names.

  • Install and configure nscd (Name Service Cache Daemon)

    Why it's wrong here

    nscd caches results but initial resolution may still be slow due to the hosts file check order.

  • Remove all entries from /etc/hosts except localhost

    Why it's wrong here

    This may break internal resolution for hosts that rely on the hosts file.

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.