Hide Forgot
Description of problem: On an Red Hat Enterprise Linux CoreOS release 4.5 node. With a pre-existing hostname "master-0.ostest.test.metalkube.org", when Keepalived configures a Virtual IP to an interface, it triggers a "set hostname" operation which does an address lookup and changes the hostname to the DNS record that matches the VIP, i.e., "ns1.ostest.test.metalkube.org". Being that Keepalived addresses are correctly marked as deprecated: 3: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000 inet6 fd2e:6f44:5dd8:c956::5/128 scope global nodad deprecated noprefixroute valid_lft forever preferred_lft 0sec inet6 fd2e:6f44:5dd8:c956::2/128 scope global nodad deprecated noprefixroute valid_lft forever preferred_lft 0sec inet6 fd2e:6f44:5dd8:c956::14/128 scope global dynamic noprefixroute valid_lft 3121sec preferred_lft 3121sec I find that this behavior is incorrect due to substituting the already configured non "localhost" hostname of a live address in the same interface with a new lookup for an address that is deprecated and not meant to be used for much else than receiving traffic. Version-Release number of selected component (if applicable): NetworkManager-1.20.0-5.el8_1.x86_64 Steps to Reproduce: 1. Set up Keepalived to configure VIPs on the same subnet and iface that gets configured by DHCPv6 2. Wait for the VIPs to get configured 3. sudo journalctl -b | cut -f 3,4 -d' ' | uniq -f 1 Actual results: begin at 17:19:12 localhost 17:19:21 master-0.ostest.test.metalkube.org 17:26:33 ns1.ostest.test.metalkube.org 17:48:15 master-0.ostest.test.metalkube.org [core@master-0 ~]$ Expected results: begin at 17:19:12 localhost 17:19:21 master-0.ostest.test.metalkube.org [core@master-0 ~]$ Additional info: This happened on a https://github.com/openshift-metal3/dev-scripts deployment
Hi, NetworkManager doesn't update the kernel hostname when there is already a static hostname configured on the machine. The static hostname is what is set in /etc/hostname and is visible with: $ hostnamectl Static hostname: fedora If somebody else sets the hostname only in kernel (using the equivalent of 'hostname foo'), it is setting the *transient* hostname. NM doesn't honor an already configured transient hostname because it assumes to be only the entity managing it. It would be racy to let NM and other tools manage the transient hostname at the same time. So, from this point of view, I think NM is doing the right thing. Talking about the deprecated address issue, NM simply takes the first address configured without considering the deprecation. Probably it should consider it; this would be easy to fix. In your case, if we modify NM to take the first non deprecated address (fd2e:6f44:5dd8:c956::14/128), would it get the right hostname (master-0.ostest.test.metalkube.org) via reverse lookup? To avoid the reverse lookup you could also set 'hostname-mode=dhcp' or even 'hostname-mode=none' in the [main] section of a new configuration file /etc/NetworkManager/conf.d/. See 'man NetworkManager.conf' for an explanation of the setting.
Oops, I missed your response. Thanks for the update. Some comments inline. (In reply to Beniamino Galvani from comment #1) > In your case, if we modify NM to take the first non deprecated address > (fd2e:6f44:5dd8:c956::14/128), would it get the right hostname > (master-0.ostest.test.metalkube.org) via reverse lookup? Yes, that's the behavior we want. > > To avoid the reverse lookup you could also set 'hostname-mode=dhcp' or > even 'hostname-mode=none' in the [main] section of a new configuration > file /etc/NetworkManager/conf.d/. See 'man NetworkManager.conf' for > an explanation of the setting. I'm not sure we can do that. We have users who are not sending the hostname via DHCP and need to do the reverse lookup in order to get the hostname set at all. We have a workaround for the DHCP case, but anyone relying on the reverse DNS is likely broken.
Created attachment 1804797 [details] Reproducer
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: NetworkManager security, bug fix, and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2021:4361
*** Bug 2052098 has been marked as a duplicate of this bug. ***