Courseiva
Question 208 of 507
NetworkingeasyMultiple ChoiceObjective-mapped

Where to Configure Static IP on CentOS 7

An administrator wants to permanently configure a static IP address on a CentOS 7 system. Which file should be edited?

Quick Answer

The answer is the file /etc/sysconfig/network-scripts/ifcfg-eth0. This is correct because CentOS 7, like its RHEL lineage, stores permanent network interface configurations in individual scripts under the /etc/sysconfig/network-scripts/ directory, named ifcfg- followed by the interface name, such as eth0. Within this file, you set BOOTPROTO=static and define the IPADDR, NETMASK, and GATEWAY parameters to establish a static IP that persists across reboots, bypassing the dynamic assignment from DHCP. On the Linux Foundation Certified System Administrator LFCS exam, this question tests your knowledge of legacy network configuration methods, as CentOS 7 still relies on these scripts by default even though NetworkManager is present. A common trap is confusing this with the newer /etc/NetworkManager/system-connections/ directory used by NetworkManager’s keyfile format, but the exam expects the traditional ifcfg path for permanent static configuration. Memory tip: think of “ifcfg” as “interface config” and remember that the file name always matches the interface name you see in ip link.

⚠ Common exam trap

The trap here is that candidates familiar with Debian-based systems may choose /etc/network/interfaces (Option D), while those who confuse global network settings with per-interface settings may pick /etc/sysconfig/network (Option B), both of which are incorrect for CentOS 7's static IP configuration.

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 interface configuration is stored in individual files under /etc/sysconfig/network-scripts/, named ifcfg-<interface>. The ifcfg-eth0 file contains parameters like BOOTPROTO, IPADDR, NETMASK, and GATEWAY, and setting BOOTPROTO=static along with the IP address values permanently configures a static IP. This is the standard method for RHEL/CentOS 7 systems using the legacy network scripts (not NetworkManager's keyfile format).

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/sysconfig/network-scripts/ifcfg-eth0

    Why this is correct

    This is the standard network interface configuration file for CentOS/RHEL 7.

  • /etc/sysconfig/network

    Why it's wrong here

    This file sets global network parameters, not per-interface IP.

  • /etc/hostname

    Why it's wrong here

    This sets the hostname, not IP address.

  • /etc/network/interfaces

    Why it's wrong here

    This is used by Debian/Ubuntu systems.

Visual reference

192.168.1.0 /24 256 addresses (254 usable) 192.168.1.0 /25 Subnet A 128 addr (126 usable) 192.168.1.128 /25 Subnet B 128 addr (126 usable) Borrowing 1 bit from host portion creates 2 subnets (/25)

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on LFCS

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. Order the steps to configure a static IP address on a CentOS/RHEL 7 system using ifcfg files.

medium
  • A.Edit the ifcfg file, then restart the network service, then verify the configuration.
  • B.Restart the network service, then edit the ifcfg file, then verify the configuration.
  • C.Edit the ifcfg file, then verify the configuration, then restart the network service.
  • D.Verify the configuration, then edit the ifcfg file, then restart the network service.

Why A: Static IP configuration requires editing the ifcfg file, restarting network, and verification.

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.