DNS contextualization is not working with Rocky Linux 9

I downloaded the Rocky Linux 9 image provided by OpenNebula and created a VM. I have set all network related parameters in the network config. The IP address, netmask etc are all correctly taken over and added to the VM but only ETH0_DNS is not used. After every reboot of the VM looses the DNS config.

Does anybody know why this happens?

Are you issuing reboots from within the VM or from OpenNebula ? You might be able to find clues as why is this the case on the one-context systemd unit reports or at /var/log/messages.

I usually reboot from within the VM. The systemd logs were already rotated. The file /var/log/messages didn’t help much. I see that NetworkManager applied the other things:

NetworkManager[957]: <info>  [1702595445.9596] audit: op="connection-update" uuid="cfde59e1-cbc6-4de7-a33b-a5d007e505a9" name="eth0" args="ipv4.addresses,ipv4.method" pid=1233 uid=0 result="success"
NetworkManager[957]: <info>  [1702595445.9891] audit: op="connection-update" uuid="cfde59e1-cbc6-4de7-a33b-a5d007e505a9" name="eth0" args="ipv4.gateway" pid=1237 uid=0 result="success"

Later I see as well that these values are set as default:

NetworkManager[957]: <info> [1702595447.3171] policy: set 'eth0' (eth0) as default for IPv4 routing and DNS

But nowhere is mentioned what happened with the DNS config value. For the “OpenNebula pre-networking contextualization” I see all values that were read in and set e.g.:

one-contextd[795]: kernel.kptr_restrict = 1
one-contextd[795]: net.ipv4.conf.default.rp_filter = 1
one-contextd[795]: net.ipv4.conf.eth0.rp_filter = 1
one-contextd[795]: net.ipv4.conf.lo.rp_filter = 1
one-contextd[948]: Done

but not for the networking part itself.

Can you show the VM instance template onevm show -j <vm_id> ?