Network Configuration and Management with nmcli
In RHEL 9, network management is driven by NetworkManager (nmcli CLI and nmtui text-user interface). Legacy ifcfg-* scripts in /etc/sysconfig/network-scripts/ are deprecated; configuration profiles are stored in keyfiles at /etc/NetworkManager/system-connections/*.nmconnection.
1. Inspecting Connections and Devices
# List all configured network connections
nmcli connection show
nmcli con show
# List physical/virtual hardware devices
nmcli device status
nmcli dev show eth0
2. High-Yield Task: Configuring a Static IPv4 Connection
To configure a persistent static IP on interface eth0 with IP 192.168.1.50/24, gateway 192.168.1.1, and DNS 192.168.1.1, 8.8.8.8:
# Modify existing connection named 'eth0'
nmcli con mod eth0 ipv4.addresses 192.168.1.50/24
nmcli con mod eth0 ipv4.gateway 192.168.1.1
nmcli con mod eth0 ipv4.dns "192.168.1.1 8.8.8.8"
nmcli con mod eth0 ipv4.method manual
nmcli con mod eth0 connection.autoconnect yes
# Apply changes immediately by cycling the connection
nmcli con up eth0
Adding a Brand New Connection Profile
nmcli con add type ethernet con-name "static-lab" ifname eth1 \
ipv4.method manual \
ipv4.addresses 10.0.0.100/24 \
ipv4.gateway 10.0.0.1 \
ipv4.dns 10.0.0.1
nmcli con up "static-lab"
3. Hostname Configuration with hostnamectl
# Display current system hostname and kernel info
hostnamectl status
# Set static hostname persistently across reboots
hostnamectl set-hostname server1.example.com
Cross-references:
- See firewalld Network Packet Filtering and Zones for firewall security on network interfaces.
- See OSI Layer 3: Network Layer for fundamental IPv4 CIDR subnetting and routing concepts.