Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
This bug was initially created as a copy of Bug #1766944
I am copying this bug because:
it also applies to RHEL8.x
Description of problem:
When configuring the network interface using DHCP and not having any static hostname, NetworkManager sets the hostname from Option 12 (Hostname) and falls back to reverse-DNS query.
However, the reverse-DNS query is not made if there is no default route (typical scenario: isolated network):
src/nm-policy.c:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
696 static void
697 update_system_hostname (NMPolicy *self, const char *msg)
698 {
:
744 /* Hostname precedence order:
745 *
746 * 1) a configured hostname (from settings)
747 * 2) automatic hostname from the default device's config (DHCP, VPN, etc)
748 * 3) the last hostname set outside NM
749 * 4) reverse-DNS of the best device's IPv4 address
750 *
751 */
:
818 priv->dhcp_hostname = FALSE;
819
820 if (!priv->default_ac4 && !priv->default_ac6) {
821 /* No best device; fall back to the last hostname set externally
822 * to NM or if there wasn't one, 'localhost.localdomain'
823 */
824 _set_hostname (self, priv->orig_hostname, "no default device");
825 return;
826 }
:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
In the code excerpt above, on line 820, a test is made whether there is some default route, which isn't the case.
This leads to setting hostname to "localhost.localdomain".
When a default route is set, then the code on line 827 and later is used instead, which ends up having a reverse lookup.
Version-Release number of selected component (if applicable):
NetworkManager-1.20.0-3.el8
How reproducible:
Always
Steps to Reproduce:
1. Install a KVM with 2 networks, 1 (eth1) being isolated
# cat > /etc/sysconfig/network-scripts/ifcfg-eth1 << EOF
TYPE="Ethernet"
BOOTPROTO="static"
DEFROUTE="no"
IPV6INIT="no"
NAME="eth1"
DEVICE="eth1"
ONBOOT="yes"
IPADDR=10.0.0.1
PREFIX=24
EOF
2. Set up a DHCP server on eth1 using dnsmasq that doesn't reply to Option 12 (Hostname) nor Option 3 (Routers) and a static lease for a client
# yum -y install dnsmasq
# cat > /etc/dnsmasq.d/dhcp.conf << EOF
domain=example.com
dhcp-range=10.0.0.100,10.0.0.250,72h
dhcp-host=52:54:00:03:f8:3b,10.0.0.100,FOO7,30d
dhcp-option=3
dhcp-option=12
EOF
# systemctl restart dnsmasq
3. Reconfigure a client VM (MAC 52:54:00:03:f8:3b above) to use the isolated network and remove static hostname
# rm /etc/hostname
# dracut -f
4. Reboot
Actual results:
FQDN Hostname set to "localhost.localdomain"
Expected results:
FQDN Hostname set to "FOO7.example.com"
Additional info:
If "dhcp-option=3" (Routers) is removed from dnsmasq, the client VM gets "FOO7" hostname.
IMHO, the current order of precedence is a bug:
1) a configured hostname (from settings)
2) automatic hostname from the default device's config (DHCP, VPN, etc)
3) the last hostname set outside NM
4) reverse-DNS of the best device's IPv4 address
It should be:
1) a configured hostname (from settings)
2) automatic hostname from the default device's config (DHCP, VPN, etc)
3) reverse-DNS of the best device's IPv4 address
4) the last hostname set outside NM
Or order kept as is but "3) the last hostname set outside NM" be a fallthrough if there was no "last hostname set outside NM", i.e. "localhost".
This issue was originally reported against rhel-7 (bug 1766944).
Then, this rhbz was created as a clone for rhel-8.
In the meantime, it doesn't seem we will address this issue in rhel-7. Sorry about that. Hence, bug 1766944 was reassigned to rhel-8.
That makes these bugs both identical. Closing this one as a duplicate.
Note that we theoretically still could solve it in rhel-7. However, at this point it is first necessary to fix in rhel-8, and then evaluate whether it's necessary to backport to rhel-7. After the issue is fixed on rhel-8 (bug 1766944), we can re-evaluate whether opening a new issue against rhel-7.
*** This bug has been marked as a duplicate of bug 1766944 ***