nmcli static IP and NetworkManager basics: the full measured chain from creating a profile to persisting it
What you will learn
Section titled “What you will learn”OL 9/10’s network-management entry point is NetworkManager + nmcli (ifcfg files are history). This page measures a safe static IP flow — create the profile, read it back, verify, then activate — never locking yourself out mid-way.
The baseline: two views
Section titled “The baseline: two views”nmcli device status # the device view: ens18 ethernet connectednmcli con show # the connection view: ens18 (UUID bound to the device)Concept alignment: a device is hardware, a connection (profile) is configuration. A device applies at most one profile at a time; a profile can be reused across devices. The ens18 profile preinstalled on a minimal OL install was generated by the installer via DHCP.
The safe static IP flow: create, verify, then activate
Section titled “The safe static IP flow: create, verify, then activate”nmcli con add type ethernet con-name ol-demo ifname ens18 \ ipv4.method manual ipv4.addresses 192.168.50.99/24 \ ipv4.gateway 192.168.50.1 ipv4.dns 223.5.5.5 autoconnect noMeasured output: Connection 'ol-demo' successfully added. At this point the running network is untouched (autoconnect=no). Read back to verify:
nmcli -g ipv4.addresses,ipv4.gateway,ipv4.dns,connection.autoconnect con show ol-demo# 192.168.50.99/24# 192.168.50.1# 223.5.5.5# noPersistence confirmed (keyfile format):
ls /etc/NetworkManager/system-connections/# ens18.nmconnection ol-demo.nmconnectionActivation and rollback
Section titled “Activation and rollback”nmcli con up ol-demo # take effect (SSH drops for a moment if the IP changes — mind your out-of-band channel)nmcli con down ol-demo && nmcli con up ens18 # roll back to the original profileCommon operations quick reference
Section titled “Common operations quick reference”| Task | Command |
|---|---|
| View the effective IP | ip -br addr |
| Change DNS | nmcli con mod <name> ipv4.dns "223.5.5.5 119.29.29.29" |
| DHCP → static | ipv4.method manual + ipv4.addresses |
| Delete a profile | nmcli con delete <name> |
| Apply after manual edits | nmcli con reload + nmcli con up <name> |
Evidence and limits on this page
Section titled “Evidence and limits on this page”- Measured: the full profile create/read-back/persist/cleanup chain (the non-activating path) (E3);
- Not measured: actually switching with
con upon the static IP (would drop the lab machine’s network; to be added once an out-of-band channel is available); - Sources: OL10 networking documentation,
nmcli(1),nm-settings-keyfile(5).