Network Interfaces and NetworkManager Configuration
CIS126RH | RHEL System Administration 1 Mesa Community College
Learning Objectives
1
Configure connections with nmcli
Create, modify, and manage network connections using the command line
2
Set static IP addressing
Configure IPv4 and IPv6 addresses, gateways, and DNS servers
3
Manage hostnames
Configure system hostname and understand hostname types
4
Understand configuration files
Know where network settings are stored and how to edit them
NetworkManager Architecture
NetworkManager is a daemon that manages network connections dynamically. It uses connection profiles that define network settings and can be activated on network devices.
nmcli / nmtui
→
NetworkManager
→
Connection Profiles
→
Network Devices
nmcli
Command-line interface for scripting and server administration
nmtui
Text-based UI for interactive configuration
nm-connection-editor
Graphical interface (desktop systems)
Configuration Files
Stored in /etc/NetworkManager/
Connections vs Devices
Connection (Profile)
Configuration template
Defines IP, DNS, gateway, etc.
Can exist without being active
Multiple connections per device possible
Stored in configuration files
Has a NAME and UUID
Device (Interface)
Physical or virtual network interface
ens33, eth0, wlan0, etc.
Can have 0 or 1 active connection
State: connected, disconnected, unmanaged
Detected by kernel/udev
Has a NAME (interface name)
# List connections (profiles)[student@server ~]$ nmcli connection show
NAME UUID TYPE DEVICE
ens33 a1b2c3d4-e5f6-7890-abcd-ef1234567890 ethernet ens33
Home b2c3d4e5-f6a7-8901-bcde-f23456789012 wifi --# List devices (interfaces)[student@server ~]$ nmcli device status
DEVICE TYPE STATE CONNECTION
ens33 ethernet connected ens33
lo loopback unmanaged --
nmcli Command Structure
nmcli [OPTIONS] OBJECT { COMMAND | help }
# Objects:
nmcli general # NetworkManager status
nmcli networking # Overall networking control
nmcli connection # Manage connections (con)
nmcli device # Manage devices (dev)
Command
Description
nmcli con show
List all connections
nmcli con show "name"
Show details of specific connection
nmcli con up "name"
Activate a connection
nmcli con down "name"
Deactivate a connection
nmcli con add ...
Create a new connection
nmcli con mod "name" ...
Modify connection settings
nmcli con del "name"
Delete a connection
nmcli dev status
Show device status
Viewing Connection Details
# Show all settings for a connection[student@server ~]$ nmcli connection show ens33
connection.id: ens33
connection.uuid: a1b2c3d4-e5f6-7890-abcd-ef1234567890
connection.type: 802-3-ethernet
connection.interface-name: ens33
connection.autoconnect: yes
ipv4.method: auto
ipv4.addresses: --
ipv4.gateway: --
ipv4.dns: --
ipv6.method: auto
...# Show only active connection settings (runtime values)[student@server ~]$ nmcli -g ipv4.addresses connection show ens33
192.168.1.100/24# Show specific fields[student@server ~]$ nmcli -f ipv4 connection show ens33
# Compare configured vs active values[student@server ~]$ nmcli connection show ens33 | grep ipv4
[student@server ~]$ nmcli device show ens33 | grep IP4
Creating Connections: DHCP
# Create a new DHCP connection[root@server ~]# nmcli connection add \
con-name "Office-DHCP" \
type ethernet \
ifname ens33
# Connection created - let's see it[student@server ~]$ nmcli connection show
NAME UUID TYPE DEVICE
Office-DHCP c3d4e5f6-a7b8-9012-cdef-345678901234 ethernet --
ens33 a1b2c3d4-e5f6-7890-abcd-ef1234567890 ethernet ens33# Activate the new connection[root@server ~]# nmcli connection up Office-DHCP
Connection successfully activated# Verify - note the new active connection[student@server ~]$ nmcli device status
DEVICE TYPE STATE CONNECTION
ens33 ethernet connected Office-DHCP
Default Settings: New Ethernet connections default to DHCP (ipv4.method auto), autoconnect enabled, and IPv6 auto-configuration.
⚠ Remote Access: When changing IP on a remote server, ensure you have console access or the new IP is correct - wrong settings can lock you out!
Modifying Connections
# Change from DHCP to static[root@server ~]# nmcli connection modify ens33 \
ipv4.method manual \
ipv4.addresses 192.168.1.100/24 \
ipv4.gateway 192.168.1.1 \
ipv4.dns "8.8.8.8"
# Add additional DNS server[root@server ~]# nmcli connection modify ens33 +ipv4.dns "8.8.4.4"
# Remove a DNS server[root@server ~]# nmcli connection modify ens33 -ipv4.dns "8.8.4.4"
# Add another IP address to existing connection[root@server ~]# nmcli connection modify ens33 +ipv4.addresses "192.168.1.101/24"
# Disable autoconnect[root@server ~]# nmcli connection modify ens33 connection.autoconnect no
# Changes saved but not active until reload[root@server ~]# nmcli connection up ens33 # Reactivate to apply[root@server ~]# nmcli connection reload # Or reload all connections
+ and - prefixes: Use + to add to existing values (like adding DNS) and - to remove specific values without replacing everything.
IPv6 Configuration
# Create connection with static IPv6[root@server ~]# nmcli connection add \
con-name "IPv6-Static" \
type ethernet \
ifname ens33 \
ipv6.method manual \
ipv6.addresses "2001:db8::10/64" \
ipv6.gateway "2001:db8::1"
# Add IPv6 to existing connection (dual-stack)[root@server ~]# nmcli connection modify ens33 \
ipv6.method manual \
ipv6.addresses "2001:db8::100/64" \
ipv6.gateway "2001:db8::1"
# Disable IPv6 on a connection[root@server ~]# nmcli connection modify ens33 ipv6.method disabled
# Enable IPv6 SLAAC (auto-configuration)[root@server ~]# nmcli connection modify ens33 ipv6.method auto
# IPv6 with link-local only (no global address)[root@server ~]# nmcli connection modify ens33 ipv6.method link-local
Dual-Stack: Modern servers should support both IPv4 and IPv6. Configure both on the same connection for full compatibility.
DNS Configuration
# Set DNS servers for a connection[root@server ~]# nmcli connection modify ens33 ipv4.dns "8.8.8.8 8.8.4.4"
# Set DNS search domain[root@server ~]# nmcli connection modify ens33 ipv4.dns-search "example.com lab.local"
# Prevent DHCP from overwriting DNS settings[root@server ~]# nmcli connection modify ens33 ipv4.ignore-auto-dns yes
# View current DNS configuration[student@server ~]$ cat /etc/resolv.conf
# Generated by NetworkManager
search example.com lab.local
nameserver 8.8.8.8
nameserver 8.8.4.4# Check which connection provides DNS[student@server ~]$ nmcli device show ens33 | grep DNS
Don't edit /etc/resolv.conf directly! NetworkManager regenerates it. Use nmcli to set DNS, or use /etc/hosts for local overrides.
Managing Connection State
# Activate a connection[root@server ~]# nmcli connection up ens33
# Activate connection on specific device[root@server ~]# nmcli connection up ens33 ifname ens33
# Deactivate a connection[root@server ~]# nmcli connection down ens33
# Disconnect a device (deactivates whatever connection is on it)[root@server ~]# nmcli device disconnect ens33
# Reconnect a device (activates its default connection)[root@server ~]# nmcli device connect ens33
# Reload connection files (after manual edits)[root@server ~]# nmcli connection reload
# Reapply connection settings without full reconnect[root@server ~]# nmcli device reapply ens33
# Delete a connection[root@server ~]# nmcli connection delete "Old-Connection"
Using nmtui
nmtui (NetworkManager Text User Interface) provides a menu-driven interface for network configuration - useful when you don't remember exact nmcli syntax.
# Launch nmtui[root@server ~]# nmtui
Edit a connection
Create, modify, or delete connection profiles
Activate a connection
Turn connections on or off
Set system hostname
Change the system hostname
Navigation
Tab, arrows, Enter, Esc to navigate
When to use nmtui: Quick interactive changes, when you don't remember nmcli syntax, or when teaching networking concepts. For scripting and automation, use nmcli.
Hostname Configuration
The hostname identifies a system on the network. RHEL has three hostname types: static, transient, and pretty.
# View current hostname[student@server ~]$ hostname
server.example.com# View all hostname types[student@server ~]$ hostnamectl
Static hostname: server.example.com
Icon name: computer-vm
Chassis: vm
Machine ID: a1b2c3d4...
Boot ID: e5f6a7b8...
Virtualization: vmware
Operating System: Red Hat Enterprise Linux 9.0
CPE OS Name: cpe:/o:redhat:enterprise_linux:9::baseos
Kernel: Linux 5.14.0-70.el9.x86_64
Architecture: x86-64# Set hostname (persistent)[root@server ~]# hostnamectl set-hostname server.example.com
# Set just the static hostname[root@server ~]# hostnamectl set-hostname server.example.com --static
# Set pretty hostname (human-friendly)[root@server ~]# hostnamectl set-hostname "Web Server 01" --pretty
Configuration Files
File/Directory
Purpose
/etc/NetworkManager/system-connections/
Connection profiles (keyfile format in RHEL 9)
/etc/sysconfig/network-scripts/
Legacy ifcfg connection files (RHEL 8 and earlier)
Note: address1 format is IP/prefix,gateway. Multiple addresses use address1, address2, etc. DNS entries end with semicolons.
Testing and Verification
# Verify interface configuration[student@server ~]$ ip addr show ens33
[student@server ~]$ nmcli device show ens33
# Verify routing[student@server ~]$ ip route
[student@server ~]$ ip route get 8.8.8.8
# Verify DNS[student@server ~]$ cat /etc/resolv.conf
[student@server ~]$ dig google.com
# Test connectivity[student@server ~]$ ping -c 3 192.168.1.1 # Gateway[student@server ~]$ ping -c 3 8.8.8.8 # Internet (IP)[student@server ~]$ ping -c 3 google.com # Internet (DNS)# Verify hostname[student@server ~]$ hostnamectl
[student@server ~]$ hostname -f # FQDN# Check NetworkManager logs for issues[student@server ~]$ journalctl -u NetworkManager --since "5 minutes ago"
Common Tasks
# Task: Change server from DHCP to static IP[root@server ~]# nmcli con mod ens33 ipv4.method manual \
ipv4.addresses 192.168.1.100/24 \
ipv4.gateway 192.168.1.1 \
ipv4.dns "8.8.8.8 8.8.4.4"
[root@server ~]# nmcli con up ens33
# Task: Add a second IP address[root@server ~]# nmcli con mod ens33 +ipv4.addresses 192.168.1.101/24
[root@server ~]# nmcli con up ens33
# Task: Set hostname and update /etc/hosts[root@server ~]# hostnamectl set-hostname server.example.com
[root@server ~]# echo "192.168.1.100 server.example.com server" >> /etc/hosts
# Task: Disable IPv6[root@server ~]# nmcli con mod ens33 ipv6.method disabled
[root@server ~]# nmcli con up ens33
# Task: Use custom DNS, ignore DHCP DNS[root@server ~]# nmcli con mod ens33 ipv4.dns "10.0.0.53" ipv4.ignore-auto-dns yes
[root@server ~]# nmcli con up ens33
Troubleshooting
# Problem: Connection won't activate[root@server ~]# journalctl -u NetworkManager -n 50 # Check logs[root@server ~]# nmcli connection show "con-name" # Verify settings# Problem: IP address not assigned[student@server ~]$ nmcli device status # Is device connected?[student@server ~]$ ip link show ens33 # Is link UP?# Problem: Can't reach gateway[student@server ~]$ ip route # Is gateway in table?[student@server ~]$ ip addr # Correct IP/subnet?# Problem: Can reach IP but not hostnames[student@server ~]$ cat /etc/resolv.conf # DNS configured?[student@server ~]$ dig @8.8.8.8 google.com # DNS server working?# Problem: Changes not taking effect[root@server ~]# nmcli connection reload # Reload files[root@server ~]# nmcli connection up ens33 # Reactivate# Problem: Connection auto-activates when you don't want it[root@server ~]# nmcli connection modify ens33 connection.autoconnect no
Best Practices
✓ Do
Use static IPs for servers
Document all network changes
Have console access before changes
Test configuration before production
Use meaningful connection names
Configure both IPv4 and IPv6
Set proper hostnames (FQDN)
Backup configs before modifying
✗ Don't
Edit /etc/resolv.conf directly
Make remote changes without backup access
Use duplicate IP addresses
Forget to reactivate after changes
Leave default connection names
Ignore IPv6 configuration
Skip verification after changes
Forget to set autoconnect appropriately
RHCSA Exam Tip: On the exam, verify networking works after each configuration change. Lost network connectivity can prevent you from completing other tasks!
Key Takeaways
1
nmcli: Primary tool for network config; connection add/modify/up/down for managing connections
2
Static IP:ipv4.method manual, specify addresses, gateway, and DNS; reactivate to apply
3
Hostname: Use hostnamectl set-hostname; update /etc/hosts for local resolution
4
Files: Connections in /etc/NetworkManager/system-connections/; verify with ip addr and ping
Graded Lab
Create a new connection with DHCP, activate it, and verify
Modify the connection to use static IP, gateway, and DNS
Add a second IP address to the connection
Configure system hostname to a FQDN and update /etc/hosts
View and understand the keyfile configuration format
Practice activating/deactivating connections and verify changes