Man 5 hostname says different thing. I would guess as many things
changes after long time, systemd would be responsible somehow.
From what they describe your machine has to obtain hostname from DHCP
lease. If it does not, it fall back to transient name "fedora". Nothing
there is mentioned about reverse DNS query.
I think you could fix it by systemd unit started
After=network-online.target. hostname -A might be useful for obtaining
hostname from address. Do not expect it to return just single name.
First name might be obtained by:
HOSTNAME=$(hostname -A | cut -d' ' -f1)
hostnamectl set-hostname --transient $HOSTNAME
Then use systemctl edit --full --force hostname-fixup.service
# Use such content for example.
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/dynamic-hostname.sh
[Install]
WantedBy=multi.target
On 1/21/22 05:16, Thomas Cameron wrote:
On 1/20/22 20:10, Thomas Cameron wrote:
>
> I made a quick video of the difference between F35 and RHEL 8.5.
>
>
https://youtu.be/KuvqInOg1u8
>
> Skip to about the 1:30 mark to see the difference between F35 and
> RHEL 8.5. I've seen the hostname assigned by reverse DNS with every
> version of RHEL since at least RHEL 4. In fact, I don't recall it
> working otherwise ever.
I just tested to make sure. Every version of RHEL from 4 through 9
beta has worked as I expected - the hostname is set based on the
reverse DNS for the IP address assigned to the instance, so
hostxxx.tc.camerontech.com.
https://youtu.be/pAVNwwrHwkw
I tested a couple of older versions of Fedora and found that older
versions like F28 work like I expect (
hostxxx.tc.camerontech.com), but
33 sets the hostname to localhost.localdomain, and 34 and 35 set the
hostname to just "fedora" with no domain or extension.
I looked at the man page for NetworkManager.conf and it looks like
hostname-mode in the [main] section *should* do what I want:
default: NetworkManager will update the hostname with the one
provided via DHCP or reverse DNS lookup of the IP address on the
connection with the default route or on any connection with the
property hostname.only-from-default set to 'false'. Connections are
considered in order of increasing value of the hostname.priority
property. In case multiple connections have the same priority,
connections activated earlier are considered first. If no hostname
can be determined in such way, the hostname will be updated to the
last one set outside NetworkManager or to 'localhost.localdomain'.
But I've tried and it doesn't seem to make any difference.
Thomas
_______________________________________________
users mailing list -- users(a)lists.fedoraproject.org
To unsubscribe send an email to users-leave(a)lists.fedoraproject.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure
--
Petr Menšík
Software Engineer
Red Hat,
http://www.redhat.com/
email: pemensik(a)redhat.com
PGP: DFCF908DB7C87E8E529925BC4931CA5B6C9FC5CB