Courseiva
Advanced Networking ConfigurationeasyMultiple SelectObjective-mapped

LPIC-2 Advanced Networking Configuration Practice Question

Which TWO statements about the /etc/hosts file are true?

⚠ Common exam trap

Many candidates assume /etc/hosts is consulted after DNS due to its static nature, but the default NSS order places it before DNS, and the file does not configure DNS servers or network interface aliases.

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

It can contain a line like '127.0.0.1 localhost'.

The /etc/hosts file maps hostnames to IP addresses, and the line '127.0.0.1 localhost' is the standard entry for the IPv4 loopback interface. This file is consulted by the system's resolver library before DNS queries are made, allowing local overrides for hostname resolution.

Answer analysis

Option-by-option breakdown

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

  • It can contain a line like '127.0.0.1 localhost'.

    Why this is correct

    Common entry for loopback.

  • It is used to resolve hostnames to IP addresses.

    Why this is correct

    Primary function.

  • It configures the DNS servers to use.

    Why it's wrong here

    DNS servers are configured in /etc/resolv.conf.

  • It is consulted after DNS by default.

    Why it's wrong here

    By default, /etc/hosts is checked before DNS (order in /etc/nsswitch.conf).

  • It can define aliases for network interfaces.

    Why it's wrong here

    Aliases are defined in /etc/network/interfaces or using ip command.

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

One of 507 original LPIC-2 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.