LFCS Networking Practice Question
A Linux server has a DNS resolver configuration in /etc/resolv.conf. You need to add a new DNS server at 8.8.8.8 and ensure it is used before the existing server. Which line should you add to the top of /etc/resolv.conf?
⚠ Common exam trap
The trap here is using incorrect keywords such as 'dns' or adding a port number to the nameserver IP, which are invalid in /etc/resolv.conf.
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
✓
nameserver 8.8.8.8
The correct line is 'nameserver 8.8.8.8'. The resolver reads nameserver entries in order, so placing it at the top makes it the first server used. The other options use invalid keywords or syntax that would not be recognized by the resolver.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
dns 8.8.8.8
Why it's wrong here
The 'dns' keyword is not a valid directive in /etc/resolv.conf. The correct keyword is 'nameserver'. Using 'dns 8.8.8.8' would be ignored by the resolver, and the new server would not be used. This is a common mistake due to confusion with other configuration files.
- ✗
nameserver 8.8.8.8:53
Why it's wrong here
The 'nameserver' directive expects an IP address only, not an IP address with a port number. Specifying a port like 8.8.8.8:53 is invalid syntax and will cause the resolver to ignore the entry. DNS queries are always sent to port 53 by default, so the port should not be specified.
- ✗
search 8.8.8.8
Why it's wrong here
The 'search' directive specifies a list of domains to append to unqualified hostnames. It does not define a DNS server. Adding 'search 8.8.8.8' would be incorrect and could cause resolution failures for unqualified names. It does not achieve the goal of adding a DNS server.
- ✓
nameserver 8.8.8.8
Why this is correct
The 'nameserver' directive specifies a DNS server. Placing 'nameserver 8.8.8.8' at the top of /etc/resolv.conf makes it the first server queried. The resolver tries nameservers in the order they appear, so this ensures it is used before the existing server. This is the correct syntax and placement.
Visual reference
Go deeper
Related to this question
About these practice questions
This LFCS question is part of Courseiva's 406-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 and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Linux Foundation exam blueprint
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.