Operations 8 min read

Master CentOS7 Network Configuration with nmcli and Manual Settings

This guide walks through CentOS7 network configuration, explaining interface naming conventions, using NetworkManager tools like nmcli, editing ifcfg files, changing hostnames, renaming interfaces to eth0, adding kernel parameters, and applying changes with service restarts.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master CentOS7 Network Configuration with nmcli and Manual Settings

Network Interface Naming in CentOS 7

CentOS 7 follows the predictable naming scheme defined by systemd‑udev. Ethernet interfaces start with en, WLAN with wl, and WWAN with ww. The second character indicates the adapter location: o = on‑board, s = hot‑plug slot, p = PCI. An optional x can be inserted for MAC‑address merging, and a trailing number is the index. If the generated name is unclear, the traditional ethX naming can be forced via kernel parameters.

NetworkManager Overview

NetworkManager is the default dynamic network controller on CentOS/RHEL 7. It keeps devices and connections active when a link is present, but only one connection per device can be active at a time. Verify its status with: systemctl status NetworkManager and the legacy network service with:

systemctl status network

Managing Connections with nmcli

nmcli device

– list all network devices. nmcli device show – display detailed properties of each device. nmcli connection – list saved connection profiles.

nmcli connection add con-name <profile> autoconnect yes ifname <iface> type ethernet

– create a new Ethernet connection. nmcli connection up <profile> – activate a connection. nmcli connection delete <profile> – remove a connection profile.

Example output of nmcli device:

DEVICE      TYPE      STATE   CONNECTION
virbr0      bridge    unmanaged  --
ens33       ethernet  unmanaged  --
lo          loopback  unmanaged  --

Example output of nmcli device show ens33 (truncated):

GENERAL.DEVICE:                         ens33
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         00:0C:29:12:F1:A1
GENERAL.MTU:                            1500
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --

Editing Network‑Script Files Directly

Configuration files reside in /etc/sysconfig/network-scripts/ifcfg-<interface>. An example for ens33:

TYPE="Ethernet"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="5ae89fd0-897c-40cc-bdfa-fd716dd6fcc5"
DEVICE="ens33"
ONBOOT="yes"

After editing, apply the changes with:

nmcli connection reload
nmcli connection down ens33
systemctl restart network

Text and Graphical Configuration Tools

Use nmtui for a curses‑based UI: nmtui Or launch the GNOME editor:

nm-connection-editor

Changing the Hostname

Edit /etc/sysconfig/network and ensure the following lines exist:

NETWORKING=yes
HOSTNAME=master

Apply the new hostname immediately:

hostname master

Renaming an Interface to eth0

Rename the ifcfg file and adjust its contents:

cd /etc/sysconfig/network-scripts
mv ifcfg-ens33 ifcfg-eth0
vi ifcfg-eth0
# modify NAME and DEVICE to "eth0"

Add a kernel boot parameter to disable the predictable naming:

vi /etc/sysconfig/grub
# Append or modify the line:
GRUB_CMDLINE_LINUX="... net.ifname=0"
# Regenerate GRUB configuration (example for BIOS systems)
grub2-mkconfig -o /boot/grub2/grub.cfg
# For UEFI systems use:
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
reboot

Images

Network configuration example
Network configuration example
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

System AdministrationCentOSLinux networkingnmcliNetworkManager
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.