My static IP network config keeps desapearing after reboot

Hello All!
I’m using Almalinux 9 .4 but I’m unable to keep it’s static IP configuration solid after reboot.
I use nmcli OR nmtui to configure it.
After reboot it just goes back to DHCP, it looses all static config.
I’ve tried to set to autoconnect to no avail.
I also notice, that I don’t have any connection files:
/etc/NetworkManager/system-connections/ empty
/run/NetworkManager/system-connections/ - one lo.nmconnection
/usr/lib/NetworkManager/system-connections/ empty

Should I just create one /run/NetworkManager/system-connections/ ‘System ens33’ It’s the name I get from “nmcli con show”.

Any help is Welcome.
Cheers
asaramago

The /run/ is in RAM. Gone on shutdown.

What do you get with:

nmcli d s
nmcli c s

Hello jlehtone
image
This is the output after reboot.
If I use nmtui to activate the connection it times out because it is set to dhcp.
If I use nmtui, I set it all to manual, with a fixed IP (which is the goal here) it works:

[root@wsAlmaLinux9 wscloud]# nmcli d s
DEVICE TYPE STATE CONNECTION
ens33 ethernet connected System ens33
lo loopback connected (externally) lo
[root@wsAlmaLinux9 wscloud]# nmcli c s
NAME UUID TYPE DEVICE
System ens33 c96bc909-188e-ec64-3a96-6a90982b08ad ethernet ens33
lo 6e9d328b-8c59-40eb-846b-dee83f0d938b loopback lo
[root@wsAlmaLinux9 wscloud]#

So, I really don’t know what I’m missing here.

Is probably a connection that NetworkManager does create on boot for interface (ens33) that has no stored connection.

Modifications of connection should go to file.


Lets start with simple test:

nmcli con mod c96bc909-188e-ec64-3a96-6a90982b08ad con-name ens33

This should rename the connection “System ens33” → “ens33”.
The nmcli c s should then show that name has changed
and
there should be new file in /etc/NetworkManager/system-connections/

I kept reading some stuff until I saw something about migrating connections:

[root@wsAlmaLinux9 wscloud]# cat /etc/sysconfig/network-scripts/readme-ifcfg-rh.txt
NetworkManager stores new network profiles in keyfile format in the
/etc/NetworkManager/system-connections/ directory.

Previously, NetworkManager stored network profiles in ifcfg format
in this directory (/etc/sysconfig/network-scripts/). However, the ifcfg
format is deprecated. By default, NetworkManager no longer creates
new profiles in this format.

Connection profiles in keyfile format have many benefits. For example,
this format is INI file-based and can easily be parsed and generated.

Each section in NetworkManager keyfiles corresponds to a NetworkManager
setting name as described in the nm-settings(5) and nm-settings-keyfile(5)
man pages. Each key-value-pair in a section is one of the properties
listed in the settings specification of the man page.

If you still use network profiles in ifcfg format, consider migrating
them to keyfile format. To migrate all profiles at once, enter:

# nmcli connection migrate

This command migrates all profiles from ifcfg format to keyfile
format and stores them in /etc/NetworkManager/system-connections/.

Alternatively, to migrate only a specific profile, enter:

# nmcli connection migrate <profile_name|UUID|D-Bus_path>

For further details, see:
** nm-settings-keyfile(5)*
** nmcli(1)*
[root@wsAlmaLinux9 wscloud]#

(NetworkManager connections) so I run:

[root@wsAlmaLinux9 wscloud]# nmcli connection migrate
Connection ‘System ens33’ (c96bc909-188e-ec64-3a96-6a90982b08ad) successfully migrated.
Connection ‘lo’ (6e9d328b-8c59-40eb-846b-dee83f0d938b) successfully migrated.
[root@wsAlmaLinux9 wscloud]#

Rebooted and all is OK now!
Could it be that?

The NetworkManager.conf of AlmaLinux 9 does have:

[main]
#plugins=keyfile,ifcfg-rh

That is a mere comment. Not sure whether that tells the (RHEL) default, or is an example for convenience.

The “keyfile,ifcfg-rh” means:

  • Read both /etc/NetworkManager/system-connections and /etc/sysconfig/network-scripts
  • Write to /etc/NetworkManager/system-connections. If not possible, write to /etc/sysconfig/network-scripts

Did you/do you have files in /etc/sysconfig/network-scripts (other than readme-ifcfg-rh.txt)?
If yes, where did they come from?

I can only assume that files @ /etc/sysconfig/network-scripts/ other than readme-ifcfg-rh.txt were generated by nmtui.

But I have a different chalenge now:
If I clone this VM to a template and deploy a template from it, it doesn’t get a static IP again, and my “Customization Specifications” (VMware) do not work, the normal one or the cloud-init one.
My goal is to have a template that deploys an AlmaLinux9 VM, with a default user, and that accepts inputs for IP address (dhcp or static) and a Public Key for the default user ‘almalinux’.
But it seems I’m going around on circles. :frowning:

I don’t know VMware. I have encountered cloud-init in OpenStack-based system, where it was possible to supply “cloud-init customizations” (i.e. config that cloud-init uses to configure the system) on VM creation.

Overall, I do like DHCP, because IMHO the machines do not have network – network has machines – and central DHCP hands them consistent config.

Regardless, it is probably critical to know how (network) config is passed to guests in VMware, whether it is cloud-init, DHCP, or whatnot. If it was cloud-init here and that was set to write to legacy ifcfg, rather than NetworkManager’s inifiles, then we have an explanation why it failed. I.e. error in cloud-init config.