SysTutorials

Configuring Network Interfaces with ifcfg Files on RHEL

· updated April 12, 2026

The /etc/sysconfig/network-scripts/ directory contains network configuration files on RHEL and Fedora systems. While newer systems increasingly use NetworkManager and systemd-networkd, understanding ifcfg files remains essential for legacy systems and certain enterprise environments.

Basic Static IP Configuration

Here’s a typical ifcfg-eth0 file for a static IP setup:

DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.151
NETMASK=255.255.0.0
GATEWAY=192.168.1.10
USERCTL=no

The key parameters:

Modern Syntax with CIDR Notation

Prefer CIDR notation over separate NETMASK parameters:

DEVICE=ens3
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.151
PREFIX=16
GATEWAY=192.168.1.10
USERCTL=no

DHCP Configuration

For dynamic IP assignment:

DEVICE=ens3
TYPE=Ethernet
BOOTPROTO=dhcp
ONBOOT=yes
USERCTL=yes

Multiple IPs on One Interface

Add secondary IPs with alias files (ifcfg-eth0:1):

DEVICE=eth0:1
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.152
PREFIX=24

Or use the modern IPADDR0, PREFIX0, IPADDR1, PREFIX1 syntax in a single file:

DEVICE=ens3
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
IPADDR0=192.168.1.151
PREFIX0=24
IPADDR1=192.168.1.152
PREFIX1=24
GATEWAY=192.168.1.10

DNS Configuration

Specify DNS servers in the ifcfg file or in /etc/resolv.conf. In ifcfg files:

DNS1=8.8.8.8
DNS2=8.8.4.4

Or use /etc/NetworkManager/conf.d/ for NetworkManager-managed systems.

Applying Changes

After editing ifcfg files, restart networking:

sudo systemctl restart network

Or for NetworkManager (modern default):

sudo nmcli connection reload
sudo nmcli connection up ens3

Verify changes:

ip addr show
ip route show

Additional Useful Parameters

When to Use ifcfg Files

Modern RHEL 9+ and recent Fedora versions default to NetworkManager. However, ifcfg files are still:

For new deployments, prefer NetworkManager’s nmcli or YAML-based netplan configurations, but understanding ifcfg files remains important for system administration across RHEL/Fedora infrastructure.

Troubleshooting Common Issues

When encountering problems on Linux systems, follow a systematic approach. Check system logs first using journalctl for systemd-based distributions. Verify service status with systemctl before attempting restarts. For network issues, use ip addr and ss -tulpn to diagnose connectivity problems.

Package management issues often stem from stale caches. Run dnf clean all on Fedora or apt clean on Ubuntu before retrying failed installations. If a package has unmet dependencies, try resolving them with dnf autoremove or apt autoremove.

These commands are frequently used alongside the tools discussed in this article:

Quick Verification

After applying the changes described above, verify that everything works as expected. Run the relevant commands to confirm the new configuration is active. Check system logs for any errors or warnings that might indicate problems. If something does not work as expected, review the steps carefully and consult the official documentation for your specific version.

← All posts