Rocky 10: why your nmcli change did nothing — modify versus reapply
Test scope
Section titled “Test scope”A Rocky Linux 10.2 Server VM with NetworkManager 1.56.0-1.el10.
Everything runs on a dummy interface — no hardware needed and no risk to the SSH path. Screenshot: public/evidence/nmcli/rocky-reapply.png.
modify does not touch the running state
Section titled “modify does not touch the running state”before: 10.97.0.1/24$ nmcli connection modify lab-c ipv4.addresses 10.97.0.9/24after modify (not applied yet): 10.97.0.1/24$ nmcli device reapply dummy0after reapply: 10.97.0.9/24Those three lines are the whole story:
nmcli connection modifywrites the profile storage only;- the live interface does not change;
nmcli device reapplypushes the new values without tearing the link down (gentler thanconnection up).
reapply versus up
Section titled “reapply versus up”| Operation | Drops the link | Use |
|---|---|---|
nmcli connection modify | no, and no effect either | stage a change |
nmcli device reapply <dev> | no (for supported properties) | apply address/DNS/route changes now |
nmcli connection up <name> | yes, rebuilds the connection | when reapply refuses the property |
Some properties (ipv4.method switching manual ↔ dhcp, for example) cannot be reapplied and require reactivation.
List properties need + and -
Section titled “List properties need + and -”$ nmcli connection modify lab-c ipv4.dns ''$ nmcli connection modify lab-c +ipv4.dns 192.168.2.241$ nmcli connection modify lab-c +ipv4.dns 1.1.1.1$ nmcli -g ipv4.dns connection show lab-c192.168.2.241,1.1.1.1$ nmcli connection modify lab-c -ipv4.dns 1.1.1.1$ nmcli -g ipv4.dns connection show lab-c192.168.2.241A plain nmcli connection modify lab-c ipv4.dns 1.1.1.1 replaces the whole list — the most common slip with multi-value properties.
Reading autoconnect-priority
Section titled “Reading autoconnect-priority”$ nmcli connection modify lab-c connection.autoconnect-priority 50$ nmcli -f NAME,AUTOCONNECT,AUTOCONNECT-PRIORITY connection show | grep lab-clab-c yes 50When several profiles with autoconnect yes target one device, the higher value wins (default 0, negatives are lower). It only influences automatic selection when the device becomes available, not a manual up.
When up is unavoidable
Section titled “When up is unavoidable”- Changing
ipv4.method(manual ↔ auto); - Changing
connection.typeor the device binding; - Any reapply that reports it needs reactivation.
Verify by comparing ip addr with nmcli -g after the reapply; if they differ, run up once.
Common traps
Section titled “Common traps”- Testing the network right after modify: nothing was applied, so the command looks broken;
- Parsing
-goutput as a table:-gprints values only; use-ffor tables; - Replacing the DNS list by accident: forgot
+; - Reapplying an address change on
ens18over SSH: expect a brief interruption; have out-of-band access first.
Practice: see the modify/reapply boundary
Section titled “Practice: see the modify/reapply boundary”sudo nmcli connection add type dummy ifname dummy8 con-name drill ipv4.method manual ipv4.addresses 10.95.0.1/24sudo nmcli connection up drillsudo nmcli connection modify drill ipv4.addresses 10.95.0.2/24ip -4 -br addr show dummy8sudo nmcli device reapply dummy8ip -4 -br addr show dummy8sudo nmcli connection delete drillChecks:
- After modify it is still 10.95.0.1;
- After reapply it is 10.95.0.2;
nmcli -g ipv4.addressesagrees withip addr;- The device disappears once the profile is deleted.
常见问题
Does reapply drop TCP connections?
Within the properties it supports it usually does not; changing addresses invalidates existing connections, while DNS or route changes generally leave established ones alone.
Why does my change revert after a reboot?
Check whether a higher-priority profile took the device, or whether you edited a file such as /etc/resolv.conf that gets overwritten.
Can nmcli and ifcfg files be mixed?
Since EL9 the keyfile backend is the default; ifcfg files under /etc/sysconfig/network-scripts/ are ignored — do not mix them.
Next steps
Section titled “Next steps”- Profile management: /en/nmcli-profiles/
- Troubleshooting: /en/network-troubleshoot/
- Network basics: /en/network-basics/