LFCS Service Configuration Practice Question
A company runs a monitoring agent service (monitor.service) that must start after the network is fully up and the DNS resolver is ready. The service currently has the following dependencies in its unit file:
[Unit]
Description=Monitoring Agent After=network.target Wants=network.target
[Service]
ExecStart=/usr/bin/monitor
The service starts, but often fails to resolve hostnames because DNS is not yet available. Which change should be made to the unit file to ensure the service only starts after DNS is ready?
⚠ Common exam trap
It's easy for candidates to confuse `network-online.target` with DNS readiness, assuming network connectivity automatically implies DNS resolution is available, but DNS is a separate service that may not be synchronized with network interface activation.
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
✓
Add a dependency: After=nss-lookup.target
`nss-lookup.target` is a synchronization point that indicates the hostname resolution subsystem (including DNS) is fully operational. By adding `After=nss-lookup.target`, the monitor service will not start until DNS resolution is available, solving the hostname resolution failures. The existing `Wants=network.target` is insufficient because `network.target` only signals that basic network interfaces are configured, not that DNS services are ready.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Replace After=network.target with After=network-online.target and add Requires=network-online.target
Why it's wrong here
Ensures network is up but not necessarily DNS.
- ✓
Add a dependency: After=nss-lookup.target
Why this is correct
Ensures name resolution services are available.
- ✗
Add Before=network.target to delay the start
Why it's wrong here
Makes service start before network, making DNS unavailable.
- ✗
Set Type=idle in the [Service] section
Why it's wrong here
Does not guarantee DNS readiness.
Visual reference
Go deeper
Related to this question
About these practice questions
This LFCS 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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LFCS practice question is part of Courseiva's free Linux Foundation 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 LFCS exam.