Red Hat System Administration I · RH124

Chapter 18

Managing Network Configuration
Connection profiles · Static routes · DNS details · Troubleshooting
CIS126RH — Mesa Community College

Chapter Objective

Create and manage multiple NetworkManager connection profiles, configure static routes and DNS settings in detail, and verify and troubleshoot network configuration.

Key Commands

  • nmcli connection add
  • nmcli connection clone
  • ip route add
  • ss
  • tracepath

Connection Profiles in Depth

A single device can have several saved connection profiles — for example, a static configuration for a server role and a DHCP fallback for testing — with only one active at a time.

# Create a brand-new connection profile from scratch
nmcli connection add type ethernet con-name static-eth0 ifname eth0 \
  ipv4.method manual ipv4.addresses 192.168.1.50/24 ipv4.gateway 192.168.1.1

# Duplicate an existing profile as a starting point for a new one
nmcli connection clone eth0 eth0-backup

# Rename a connection profile
nmcli connection modify eth0-backup connection.id eth0-lab

# Delete a connection profile entirely
nmcli connection delete eth0-backup

# Control whether a profile activates automatically at boot
nmcli connection modify static-eth0 connection.autoconnect yes
Tip — Clone Before You Experiment — Cloning a known-good profile before testing changes gives you an easy way back to a working configuration — just activate the original again instead of trying to remember and undo each change.

Where Configuration Lives

NetworkManager stores each connection profile as a keyfile on disk. You generally shouldn't hand-edit these directly — use nmcli or nmtui — but knowing where they live helps when auditing or backing up configuration.

# Connection profiles are stored here, one file per connection
ls /etc/NetworkManager/system-connections/

# View a profile's raw keyfile contents (readable only by root)
sudo cat /etc/NetworkManager/system-connections/static-eth0.nmconnection
Warning — Reload After Manual Edits — If you do edit a keyfile directly (for scripting or version control purposes), NetworkManager won't notice the change on its own. Run nmcli connection reload afterward so it re-reads the files from disk.

Managing Static Routes

Beyond the default gateway, a system sometimes needs a specific route to reach a particular network through a different path.

# View the current routing table
ip route show

# Add a temporary static route (lost on reboot / interface restart)
sudo ip route add 10.10.20.0/24 via 192.168.1.254

# Remove a route
sudo ip route del 10.10.20.0/24

# Add a PERSISTENT static route to a connection profile
nmcli connection modify eth0 +ipv4.routes "10.10.20.0/24 192.168.1.254"

# Reactivate the connection to apply it
nmcli connection up eth0
Note — Two Different Kinds of "Temporary"ip route add changes the live routing table immediately but doesn't survive a reboot or reconnection. Adding the route through nmcli connection modify makes it part of the saved profile, so it's reapplied every time the connection activates.

DNS and Search Domains

# Set one or more DNS servers on a connection
nmcli connection modify eth0 ipv4.dns "192.168.1.1 8.8.8.8"

# Set a DNS search domain, so short names get it appended automatically
nmcli connection modify eth0 ipv4.dns-search example.com

# Prevent DHCP-provided DNS servers from being used, keeping only the ones set above
nmcli connection modify eth0 ipv4.ignore-auto-dns yes

# Apply the changes
nmcli connection up eth0

# Confirm what's actually in effect right now
cat /etc/resolv.conf
Tip — resolv.conf Is Generated, Not Edited — On a NetworkManager-managed system, /etc/resolv.conf is typically generated automatically from active connection profiles. Editing it by hand usually gets overwritten — change DNS settings through nmcli instead.

Multiple Addresses on One Connection

A single connection can hold more than one IPv4 address — useful when a server needs to answer on more than one address without a separate physical interface.

# Add a secondary address without replacing the primary one
nmcli connection modify eth0 +ipv4.addresses 192.168.1.51/24

# Remove a specific secondary address
nmcli connection modify eth0 -ipv4.addresses 192.168.1.51/24

# Apply the change
nmcli connection up eth0
Exam Note — Note the + and - prefixes: they add to or remove from a multi-value property like ipv4.addresses or ipv4.dns, rather than replacing the entire list the way setting the property directly (without a prefix) would.

Verifying and Troubleshooting

# Overall connectivity status summary
nmcli general status

# Full detail on one device: state, IP config, DNS, routes
nmcli device show eth0

# Show listening and established network sockets
ss -tuln

# Trace the network path to a destination, hop by hop
tracepath example.com

# Watch DNS resolution specifically
getent hosts example.com
Tip — nmcli device show Is the One-Stop Summary — Instead of separately checking ip addr, ip route, and DNS settings, nmcli device show device lays out the full effective configuration for that device in one place.

Key Terms for Chapter 18

keyfile
The on-disk file format NetworkManager stores connection profiles in
static route
A manually defined path to a specific network, beyond the default gateway
search domain
A DNS suffix automatically appended to unqualified hostnames during resolution
secondary address
An additional IP address assigned to a connection alongside its primary address
ss
Command that displays listening and established network sockets
tracepath
Command that traces the network path to a destination, hop by hop

Review Questions

  1. What is the advantage of cloning a connection profile before experimenting with its settings?
  2. Where do NetworkManager connection profiles live on disk, and what command should you run if you edit one by hand?
  3. What's the difference between adding a route with ip route add versus with nmcli connection modify ... +ipv4.routes?
  4. Why does editing /etc/resolv.conf directly often fail to have a lasting effect on a NetworkManager-managed system?
  5. What do the + and - prefixes do when used with nmcli connection modify on a property like ipv4.addresses?
  6. Write a command that shows the complete effective network configuration for the device eth0 in one place.
  7. What command would you use to trace the network path, hop by hop, to a remote host?
1 / 10