Server requires reboot after modifying the interface configuration file

I modified the interface configuration file as follows:

vi /etc/sysconfig/network-scripts/ifcfg-ens160

I have changed the IP and gateway. I run the command as follows:

nmcli connection down ens160 && nmcli connection up ens160

However, the IP address does not change when I do ifconfig. I have to reboot the server for the change to take place.

What other commands can I run so I won’t have to reboot the server? I am running AlmaLinux 8.6.

It does sound like the NetworkManager does not monitor/check files for change. It should read the files on start, so systemctl restart NetworkManager ought to pick up the new content.

However, those files are not used in EL9 any more, so you are better off to learn not to edit files already now, in EL8. Use nmcli (nmtui) to modify connections. For example:

sudo nmcli con mod ens160 ipv4.addresses ipv4.gateway

Yes, it seems it can’t pick up changes to the file. nmcli connection up ens160 works for nmcli connection edit ens160 , nmcli connection modify ens160 and nmtui.

It is not recommended to edit the files manually. Either use nmtui or nmcli like this (first replacing the variables of course) to set a static ipv4 ip:

nmcli general hostname $fqdn
nmcli con mod $device ipv4.addresses $ip ipv4.gateway $gw ipv4.method manual ipv4.dns $dns ipv4.dns-search $search ipv6.method disabled connection.autocon
nect yes
nmcli connection up id $device
nmcli device reapply $device