RHCSAv10 · RHEL 10

Lessons

Networking with nmcli and firewalld

updated 2026-10-19 by seed

Goal

Change a network connection without breaking SSH, and open exactly what is needed in the firewall.

nmcli

nmcli device status
nmcli connection show
nmcli con mod "Wired connection 1" ipv4.method manual \
      ipv4.addresses 192.168.130.50/24 \
      ipv4.gateway 192.168.130.1 \
      ipv4.dns "192.168.130.1 1.1.1.1"
nmcli con up "Wired connection 1"

Create a new connection:

nmcli con add type ethernet ifname eth0 con-name lan0 ipv4.method manual \
      ipv4.addresses 192.168.130.50/24 ipv4.gateway 192.168.130.1

Hostname and resolution

hostnamectl set-hostname rhcsa.lab.example.com
hostnamectl status
echo "192.168.130.40 nfs.lab.example.com" >> /etc/hosts

firewalld

firewall-cmd --state
firewall-cmd --get-active-zones
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload
firewall-cmd --list-all

Without --permanent the rule disappears on reload; with it, the rule is not active until --reload.

Diagnostics

ss -tulpn
ip -br a
ping -c1 192.168.130.1

Verify

nmcli -f NAME,DEVICE,STATE con show
firewall-cmd --list-all