Skip to content

Network Configuration

Persistent network settings live in a configuration service, not in ip commands: NetworkManager on RHEL, and netplan rendering to systemd-networkd on Ubuntu Server. Setting a static address, DNS servers and the hostname with these tools is an RHCSA task and a routine server change.

Track: Core · Interview weight: Med


Must-Know Facts

Fact Value Verify with
RHEL stack NetworkManager; profiles are keyfiles in /etc/NetworkManager/system-connections/ nmcli connection show
RHEL 10 No ifcfg-rh plugin, so /etc/sysconfig/network-scripts files are ignored; RHEL 9 still reads them but writes keyfiles ls /usr/lib64/NetworkManager/*/
Connection vs device A connection (profile) is applied to a device (interface) nmcli device status
Change a profile nmcli con mod edits the file; nmcli con up or nmcli dev reapply applies it ip -br addr
Add to a list +ipv4.addresses, -ipv4.addresses; without the sign the list is replaced nmcli -g ipv4.addresses con show <name>
Auto profiles NetworkManager creates Wired connection 1 (DHCP) for an unconfigured NIC; no-auto-default=* stops it nmcli connection show
Ubuntu stack netplan YAML in /etc/netplan/*.yaml generates systemd-networkd (server) or NetworkManager (desktop) files netplan get
netplan files Mode 0600; lists use YAML sequences; indentation is significant sudo netplan generate
Apply safely netplan try reverts after the timeout unless confirmed; netplan apply does not sudo netplan try
cloud-init Writes /etc/netplan/50-cloud-init.yaml on cloud images ls /etc/netplan
Hostname hostnamectl set-hostname writes /etc/hostname; hostname -s is the short name hostnamectl
Name for the host Add the hostname to /etc/hosts when no DNS record exists getent hosts $(hostname)

Which Service Owns the Network

RHEL writes keyfiles and runs NetworkManager; Ubuntu Server renders netplan to systemd-networkd, and Ubuntu Desktop renders it to NetworkManager. The lab playgrounds configure eth0 from the kernel command line (ip=...), so the examples below leave eth0 alone on Rocky and give NetworkManager only eth1. Two services managing one interface fight over its addresses, so one owner per interface is the rule.


NetworkManager with nmcli

A drop-in keeps eth0 unmanaged. After eth1 was removed from systemd-networkd and NetworkManager started, it had already created a profile of its own:

nmcli device status
nmcli connection show

Output:

DEVICE  TYPE      STATE                                  CONNECTION         
eth1    ethernet  connecting (getting IP configuration)  Wired connection 1 
lo      loopback  connected (externally)                 lo                 
eth0    ethernet  unmanaged                              --                 
NAME                UUID                                  TYPE      DEVICE 
Wired connection 1  256717f9-c46d-39f5-b398-0c72c887d02a  ethernet  eth1   
lo                  b50b1f73-84d5-4613-badd-b429668e6c8d  loopback  lo     

Wired connection 1 asks for DHCP on a network that has none, and it removed the static address eth1 had before.

NetworkManager replaces addresses on NICs it considers unconfigured

Starting NetworkManager on a host whose NIC was configured by something else can drop that NIC's address. Create the profile first, or set no-auto-default=* in /etc/NetworkManager/conf.d/.

Create a Static Profile

sudo nmcli connection add type ethernet con-name dmz ifname eth1 ipv4.method manual ipv4.addresses 172.16.1.2/24 ipv4.dns 1.1.1.1 ipv6.method link-local
sudo nmcli connection up dmz
nmcli -f NAME,DEVICE,AUTOCONNECT connection show
ip -br addr show eth1
sudo cat /etc/NetworkManager/system-connections/dmz.nmconnection
cat /etc/resolv.conf

Output:

Connection 'dmz' (5a0ec80e-2d3c-459d-b64e-f010d9048b0c) successfully added.
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
NAME                DEVICE  AUTOCONNECT 
dmz                 eth1    yes         
lo                  lo      yes         
Wired connection 1  --      yes         
eth1             UP             172.16.1.2/24 fe80::34f1:4b76:5f94:87b7/64 
[connection]
id=dmz
# ... (trimmed)
interface-name=eth1
# ... (trimmed)
[ipv4]
address1=172.16.1.2/24
dns=1.1.1.1;
method=manual
# ... (trimmed)
# Generated by NetworkManager
nameserver 1.1.1.1

A gateway is set with ipv4.gateway; this leg has none because the default route leaves through eth0. The link-local address is no longer derived from the MAC: NetworkManager uses stable-privacy addresses by default.

NetworkManager rewrites /etc/resolv.conf

Every DNS server in active profiles replaces the file's content, which here also dropped the playground's own resolvers. Set DNS in the profiles (ipv4.dns, ipv4.ignore-auto-dns) instead of editing the file, or set dns=none under [main] when another tool owns it.

Change and Apply

sudo nmcli connection modify dmz +ipv4.addresses 172.16.1.21/24
ip -br addr show eth1
sudo nmcli connection up dmz >/dev/null
ip -br addr show eth1
nmcli -g ipv4.addresses,ipv4.dns connection show dmz
sudo nmcli connection modify dmz -ipv4.addresses 172.16.1.21/24
sudo nmcli device reapply eth1
nmcli -f GENERAL.STATE,IP4 device show eth1

Output:

eth1             UP             172.16.1.2/24 fe80::34f1:4b76:5f94:87b7/64 
eth1             UP             172.16.1.2/24 172.16.1.21/24 fe80::34f1:4b76:5f94:87b7/64 
172.16.1.2/24, 172.16.1.21/24
1.1.1.1
Connection successfully reapplied to device 'eth1'.
GENERAL.STATE:                          100 (connected)
IP4.ADDRESS[1]:                         172.16.1.2/24
IP4.GATEWAY:                            --
IP4.ROUTE[1]:                           dst = 172.16.1.0/24, nh = 0.0.0.0, mt = 100
IP4.DNS[1]:                             1.1.1.1

modify changed only the profile; the address appeared after connection up, and device reapply applies changes without taking the link down. Without sudo and polkit, modify fails with Error checking authorization.

The leftover automatic profile is deleted and blocked from coming back; nmtui offers the same settings as a text menu, which the RHCSA exam allows:

sudo nmcli connection delete 'Wired connection 1'
printf '[main]\nno-auto-default=*\n' | sudo tee /etc/NetworkManager/conf.d/91-no-auto-default.conf
sudo systemctl reload NetworkManager

netplan on Ubuntu

The Ubuntu client gets its existing address plus a second one, matched by MAC so a rename cannot break it:

sudo cat /etc/netplan/60-lan.yaml
sudo netplan generate
sudo cat /run/systemd/network/10-netplan-lan.network

Output:

network:
  version: 2
  renderer: networkd
  ethernets:
    lan:
      match:
        macaddress: "02:00:ac:10:00:02"
      set-name: eth0
      addresses:
        - 172.16.0.2/24
        - 172.16.0.20/24
      routes:
        - to: default
          via: 172.16.0.1
      nameservers:
        addresses: [1.1.1.1, 8.8.8.8]
        search: [lab.internal]
[Match]
PermanentMACAddress=02:00:ac:10:00:02
Name=eth0
# ... (trimmed)
Address=172.16.0.2/24
Address=172.16.0.20/24
DNS=1.1.1.1
# ... (trimmed)
Gateway=172.16.0.1

netplan generate only writes files under /run/systemd/network/; apply makes networkd load them. try applies and then reverts unless ENTER is pressed, which protects a remote session from a lockout:

sudo netplan try --timeout 10 < /dev/null
sudo netplan apply
ip -br addr show eth0
ip route show default
networkctl status eth0 --no-pager | head -4

Output:

# ... (trimmed)
Press ENTER before the timeout to accept the new configuration
# ... (trimmed)
Reverting.
eth0             UP             172.16.0.2/24 172.16.0.20/24 fe80::acff:fe10:2/64 
default via 172.16.0.1 dev eth0 proto static 
● 2: eth0
                   Link File: /run/systemd/network/10-netplan-lan.link
                Network File: /run/systemd/network/10-netplan-lan.network
                       State: routable (configured)

proto static marks the default route as set by networkd from the YAML file.


Hostname

sudo hostnamectl set-hostname gw.lab.internal
hostname; hostname -s; cat /etc/hostname

Output:

gw.lab.internal
gw
gw.lab.internal

hostnamectl without arguments shows the static hostname, the machine ID, the virtualization type and the OS. The hostname does not have to resolve, but many tools (sudo, Java, mail) wait for a lookup, so a matching line in /etc/hosts avoids delays.


Common Errors

Error in network definition: expected sequence

Cause: a netplan list such as addresses was written as a single value.

Fix: use addresses: [172.16.0.2/24] or a - list.

Invalid YAML: inconsistent indentation

Cause: a key in the netplan file is indented differently from its siblings.

Fix: align it; sudo netplan generate shows the line and column without touching the network, and warns Permissions ... are too open for files not set to 0600.


Interview Checkpoints

L1: What is the difference between a connection and a device in NetworkManager?

Say first: a device is the interface; a connection is a saved profile of settings that NetworkManager activates on a device.

Proof: nmcli device status; nmcli connection show.

Follow-up: Why does nmcli con mod not change the running address?

L1: How is networking configured on Ubuntu Server compared with RHEL?

Say first: Ubuntu uses netplan YAML that generates systemd-networkd files; RHEL uses NetworkManager keyfiles managed with nmcli.

Proof: ls /etc/netplan; ls /etc/NetworkManager/system-connections.

Follow-up: Which tool writes /etc/resolv.conf on each?

L2: Give eth1 the static address 172.16.1.2/24 with DNS 1.1.1.1 on RHEL, permanently.

Say first: add a manual profile with nmcli and bring it up.

Proof: sudo nmcli con add type ethernet con-name dmz ifname eth1 ipv4.method manual ipv4.addresses 172.16.1.2/24 ipv4.dns 1.1.1.1; sudo nmcli con up dmz.

Follow-up: How do you add a second address without removing the first? On Ubuntu, how do you apply a netplan change without risking a lockout? (netplan try.)

L2: Set the hostname to web01.lab.internal so it survives a reboot.

Say first: hostnamectl set-hostname, plus an /etc/hosts entry when DNS has no record.

Proof: sudo hostnamectl set-hostname web01.lab.internal; getent hosts web01.lab.internal.

Follow-up: What is the difference between the static and the transient hostname?

L3: After installing NetworkManager on a server, a secondary NIC lost its IP address. Why?

Say first: NetworkManager created an automatic DHCP profile for a NIC it saw as unconfigured and replaced the old address.

Proof: nmcli con show lists Wired connection 1 on the device; journalctl -u NetworkManager.

Follow-up: How do you prevent it? (no-auto-default=*, or create the profile first.)

L3: DNS entries you added to /etc/resolv.conf disappear after a while. What is happening?

Say first: a service owns the file (NetworkManager, systemd-resolved or the cloud agent) and rewrites it.

Proof: head -1 /etc/resolv.conf shows # Generated by NetworkManager; ls -l /etc/resolv.conf shows a symlink for systemd-resolved.

Follow-up: Where should the DNS servers be set instead?


Captured on Rocky Linux 10.2 (NetworkManager 1.56) and Ubuntu 24.04.4 (systemd 255, netplan) on iximiuz Labs FlexBox microVMs, kernel 6.1.167, 2026-09. MAC addresses are replaced with placeholders.