Interview Prep/Linux/Networking, SSH and remote access

A new server needs a static IP, gateway and DNS on RHEL 9. How do you configure it persistently?

BeginnerScenarioNetworking, SSH and remote access
Answer

Situation read → NetworkManager via nmcli.

What I'd do →

nmcli con show
sudo nmcli con mod "System eth0" ipv4.method manual \
  ipv4.addresses 10.0.1.25/24 ipv4.gateway 10.0.1.1 \
  ipv4.dns "10.0.0.2 10.0.0.3" ipv4.dns-search example.internal
sudo nmcli con up "System eth0"
ip addr show eth0; ip route; resolvectl status 2>/dev/null || cat /etc/resolv.conf

Why → Edits through nmcli persist in the connection profile; editing /etc/resolv.conf directly gets overwritten.

Interview tip → On Ubuntu say Netplan (/etc/netplan/*.yaml + netplan try), which rolls back if you lose connectivity.

All Linux questions Roadmap: Linux

More on Networking, SSH and remote access