On 1/17/22 01:42, Peter Boy wrote:
I was already afraid that I had overlooked something essential. :-)
The default configuration rather follows the opposite principle. The hostname should be well defined and independent of changing IP addresses. I guess the only way will be to determine the hostname via script and call networkctl with it. Unfortunately rclocal is lost. You use KVM on Fedora Server that includes libvirt. It provides hooks which you can use to automatically execute scripts when libvirt finishes initialisation. See https://libvirt.org/hooks.html. As an example I use that to fix some issues with systems-resolved and libvirt (https://docs.stg.fedoraproject.org/en-US/fedora-server/virtualization-instal...)
You can also use it to trigger /etc/profile.d/hostname.sh without login. Systemd also provides a replacement for rc.local, but last time I checked it, it was quite tricky.
Well, I did create an /etc/profile.d/hostname.sh script, and it works, but it requires someone to login from the console or ssh. It's hackish and I don't like it.
Thomas