LFCS Networking Practice Question
A system administrator needs to configure a static IP address on a CentOS 7 server. Which file should be edited to set the IP address permanently?
⚠ Common exam trap
The trap here is that candidates familiar with Ubuntu or Debian systems may incorrectly choose /etc/network/interfaces (Option B) or /etc/netplan/01-netcfg.yaml (Option A), forgetting that CentOS 7 uses the Red Hat-style ifcfg scripts in /etc/sysconfig/network-scripts/.
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
✓
/etc/sysconfig/network-scripts/ifcfg-eth0
On CentOS 7, network interfaces are configured via scripts located in /etc/sysconfig/network-scripts/, with each interface having a file named ifcfg-<interface>. The ifcfg-eth0 file stores static IP settings such as IPADDR, NETMASK, and GATEWAY, which are read by the network service (network.service) to apply persistent configuration.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
/etc/netplan/01-netcfg.yaml
Why it's wrong here
Used on Ubuntu 18.04+ with netplan.
- ✗
/etc/network/interfaces
Why it's wrong here
Used on Debian/Ubuntu, not CentOS.
- ✗
/etc/hostname
Why it's wrong here
Used for setting hostname, not IP address.
- ✓
/etc/sysconfig/network-scripts/ifcfg-eth0
Why this is correct
Correct file for CentOS 7 static IP configuration.
Visual reference
Go deeper
Related to this question
About these practice questions
Courseiva writes every LFCS question from scratch — 507 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.