On 1/16/22 22:40, Tim via users wrote:
On Sun, 2022-01-16 at 15:53 -0600, Thomas Cameron wrote:
All of a sudden with F35, no matter what the address of the VM is,
its hostname is set to fedora. Just fedora. Not
fedora.tc.camerontech.com.
I see your pain, that doesn't really work well when you have several
Fedora PCs, does it?  (I'm Spartacus, and I'm Spartacus, too.)

My quirky humour would have put into the install routine a "name your
computer" question.  And if you didn't, it'd randomly pick a name from
a list to each computer (George, Fred, Jenny, etc) for you.


I want F35 to have the same behavior as previous versions of Fedora
and RHEL and Ubuntu and so on. I don't want to manually set
/etc/hostname and monkey with hostnamectl because if the VM gets a
new address, I don't want to have to go and change /etc/hostname or
anything.

I've been poking around with /etc/NetworkManager/NetworkManager.conf

What about customising the dhcp client config?  So it accepts the
hostname name supplied from your DHCP server, or derived from your
reverse DNS lookup, and passes it to whatever is setting the hostname
on Fedora these days.

Like you, that's what I expect to happen, *unless* the user specifies
otherwise.
 

That's the thing, I am not even sure what I'd do on the client side.

As a dirty hack, I created a file /etc/profile.d/hostname.sh:

MYIP=`hostname -I`
MYHOSTNAME=`host $MYIP | awk '{ print $NF }' | sed "s/\.$//"`
echo $MYHOSTNAME > /etc/hostname
hostnamectl hostname $MYHOSTNAME

That sets the hostname correctly but it's a dirty hack in that it requires someone to actually log in to run the trigger the profile.d stuff. I am trying to find where in the dhclient stuff I should work to have the hostname set correctly from dhcp/dns resolution. It's frustrating that with F34 and F35, the systemd-hostnamed.service is supposed to do this but I'm not seeing where to make it do what I want it to. I've played with the /etc/NetworkManager/NetworkManager.conf file setting the hostname-mode=default in [main] but it's not working.

Thomas