After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 778004 - domain name does not get set to DHCP parameters
domain name does not get set to DHCP parameters
Status: RESOLVED OBSOLETE
Product: NetworkManager
Classification: Platform
Component: IP and DNS config
1.4.x
Other Linux
: Normal major
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-01-31 22:07 UTC by Philip Prindeville
Modified: 2020-11-12 14:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Validated via /etc/dhcp/dhclient.d/hostname.sh script (258 bytes, text/plain)
2017-02-10 19:34 UTC, Philip Prindeville
Details
Corrected version of /etc/dhcp/dhclient.d/hostname.sh (260 bytes, text/plain)
2017-02-10 21:04 UTC, Philip Prindeville
Details

Description Philip Prindeville 2017-01-31 22:07:15 UTC
I'm running Centos 7.3 (1611 updated) on a small farm of servers.  I have an OpenWRT firewall running dnsmasq as the DHCP server.  The hosts are configured as:

NetworkManager 1.4.0
linux 3.10.0
ISC dhclient 4.2.5

My /etc/sysconfig/network file is effectively empty (except for a comment).

My ethernet connection is configured as:

connection.id:                          eno1
connection.uuid:                        9a876b0d-cf74-4dc9-8d1f-f67be51dcd00
connection.stable-id:                   --
connection.interface-name:              eno1
connection.type:                        802-3-ethernet
connection.autoconnect:                 yes
connection.autoconnect-priority:        0
connection.timestamp:                   1485899676
connection.read-only:                   no
connection.permissions:                 
connection.zone:                        --
connection.master:                      --
connection.slave-type:                  --
connection.autoconnect-slaves:          -1 (default)
connection.secondaries:                 
connection.gateway-ping-timeout:        0
connection.metered:                     unknown
connection.lldp:                        -1 (default)
802-3-ethernet.port:                    --
802-3-ethernet.speed:                   0
802-3-ethernet.duplex:                  --
802-3-ethernet.auto-negotiate:          yes
802-3-ethernet.mac-address:             --
802-3-ethernet.cloned-mac-address:      --
802-3-ethernet.generate-mac-address-mask:--
802-3-ethernet.mac-address-blacklist:   
802-3-ethernet.mtu:                     auto
802-3-ethernet.s390-subchannels:        
802-3-ethernet.s390-nettype:            --
802-3-ethernet.s390-options:            
802-3-ethernet.wake-on-lan:             1 (default)
802-3-ethernet.wake-on-lan-password:    --
ipv4.method:                            auto
ipv4.dns:                               
ipv4.dns-search:                        
ipv4.dns-options:                       (default)
ipv4.dns-priority:                      0
ipv4.addresses:                         
ipv4.gateway:                           --
ipv4.routes:                            
ipv4.route-metric:                      -1
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-timeout:                      0
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.dhcp-fqdn:                         --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv4.dad-timeout:                       -1 (default)
ipv6.method:                            auto
ipv6.dns:                               
ipv6.dns-search:                        
ipv6.dns-options:                       (default)
ipv6.dns-priority:                      0
ipv6.addresses:                         
ipv6.gateway:                           --
ipv6.routes:                            
ipv6.route-metric:                      -1
ipv6.ignore-auto-routes:                no
ipv6.ignore-auto-dns:                   no
ipv6.never-default:                     no
ipv6.may-fail:                          yes
ipv6.ip6-privacy:                       -1 (unknown)
ipv6.addr-gen-mode:                     stable-privacy
ipv6.dhcp-send-hostname:                yes
ipv6.dhcp-hostname:                     --
ipv6.token:                             --
GENERAL.NAME:                           eno1
GENERAL.UUID:                           9a876b0d-cf74-4dc9-8d1f-f67be51dcd00
GENERAL.DEVICES:                        eno1
GENERAL.STATE:                          activated
GENERAL.DEFAULT:                        yes
GENERAL.DEFAULT6:                       no
GENERAL.VPN:                            no
GENERAL.ZONE:                           --
GENERAL.DBUS-PATH:                      /org/freedesktop/NetworkManager/ActiveConnection/9
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/Settings/2
GENERAL.SPEC-OBJECT:                    /
GENERAL.MASTER-PATH:                    --
IP4.ADDRESS[1]:                         192.168.1.53/24
IP4.GATEWAY:                            192.168.1.252
IP4.DNS[1]:                             192.168.1.252
IP4.DOMAIN[1]:                          redfish-solutions.com
DHCP4.OPTION[1]:                        requested_classless_static_routes = 1
DHCP4.OPTION[2]:                        requested_rfc3442_classless_static_routes = 1
DHCP4.OPTION[3]:                        subnet_mask = 255.255.255.0
DHCP4.OPTION[4]:                        requested_subnet_mask = 1
DHCP4.OPTION[5]:                        domain_name_servers = 192.168.1.252
DHCP4.OPTION[6]:                        ip_address = 192.168.1.53
DHCP4.OPTION[7]:                        requested_static_routes = 1
DHCP4.OPTION[8]:                        dhcp_server_identifier = 192.168.1.252
DHCP4.OPTION[9]:                        requested_nis_servers = 1
DHCP4.OPTION[10]:                       requested_time_offset = 1
DHCP4.OPTION[11]:                       broadcast_address = 192.168.1.255
DHCP4.OPTION[12]:                       requested_interface_mtu = 1
DHCP4.OPTION[13]:                       dhcp_rebinding_time = 35290
DHCP4.OPTION[14]:                       requested_domain_name_servers = 1
DHCP4.OPTION[15]:                       dhcp_message_type = 5
DHCP4.OPTION[16]:                       requested_broadcast_address = 1
DHCP4.OPTION[17]:                       routers = 192.168.1.252
DHCP4.OPTION[18]:                       dhcp_renewal_time = 19090
DHCP4.OPTION[19]:                       requested_domain_name = 1
DHCP4.OPTION[20]:                       domain_name = redfish-solutions.com
DHCP4.OPTION[21]:                       requested_routers = 1
DHCP4.OPTION[22]:                       expiry = 1485942238
DHCP4.OPTION[23]:                       host_name = kvm1
DHCP4.OPTION[24]:                       requested_wpad = 1
DHCP4.OPTION[25]:                       requested_nis_domain = 1
DHCP4.OPTION[26]:                       requested_ms_classless_static_routes = 1
DHCP4.OPTION[27]:                       network_number = 192.168.1.0
DHCP4.OPTION[28]:                       requested_domain_search = 1
DHCP4.OPTION[29]:                       next_server = 192.168.1.252
DHCP4.OPTION[30]:                       requested_ntp_servers = 1
DHCP4.OPTION[31]:                       ntp_servers = 192.168.1.40
DHCP4.OPTION[32]:                       dhcp_lease_time = 43200
DHCP4.OPTION[33]:                       requested_host_name = 1
IP6.ADDRESS[1]:                         fe80::7a51:4743:f861:a93f/64
IP6.GATEWAY:   

my current lease file looks like:

...
lease {
  interface "eno1";
  fixed-address 192.168.1.53;
  option subnet-mask 255.255.255.0;
  option routers 192.168.1.252;
  option dhcp-lease-time 43200;
  option dhcp-message-type 5;
  option domain-name-servers 192.168.1.252;
  option dhcp-server-identifier 192.168.1.252;
  option dhcp-renewal-time 19090;
  option ntp-servers 192.168.1.40;
  option broadcast-address 192.168.1.255;
  option dhcp-rebinding-time 35290;
  option host-name "kvm1";
  option domain-name "redfish-solutions.com";
  renew 3 2017/02/01 02:46:17;
  rebind 3 2017/02/01 07:32:08;
  expire 3 2017/02/01 09:43:58;
}

hostnamectl tells me:

   Static hostname: localhost.localdomain
Transient hostname: kvm1
         Icon name: computer-server
           Chassis: server
        Machine ID: d4033d25d4854fcd9268f676a73fd109
           Boot ID: d2c9c81e089649d1ab0203e3e5463146
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-514.6.1.el7.x86_64
      Architecture: x86-64

I get "kvm1" from "hostname" and "kvm1.redfish-solutions.com" from "hostname -f".

And I get "" from "domainname".

Why am I not getting "kvm1.redfish-solutions.com" from "hostname", which is what I get if I turn off NetworkManager.service and enable the dumb init.d scripts called "network.service" instead?

The lack of a domain name means that postfix is convinced my domain is ".localdomain" and I have to manually set it otherwise.

I tried hacking my /etc/dhcp/dhclient.conf file to have:

also require fqdn.fqdn;

but this made no difference.

The only place that the domain name seems to turn up is in /etc/resolv.conf as the "search" parameter (but curiously not as the "domain" parameter).

Please add a knob to force the machine's hostname to be set to the FQDN by NetworkManager when using DHCP.
Comment 1 Philip Prindeville 2017-01-31 22:17:40 UTC
Regarding the /etc/resolv.conf discrepancy of "search" via "domain", the DHCP option 119 is pretty clearly what was intended to populate the "search" parameter(s), per RFC-3397 Section 2, and DHCP option 15 per RFC-2132 is intended for the "domain".
Comment 2 Dan Williams 2017-02-10 18:32:31 UTC
Per the IRC discussion, there are two separate issues with domain/search:

1) resolv.conf - this only affects things that call gethostbyname(3) and use the glibc resolver to look up a name.  We stopped NM setting 'domain' between 0.9.8 and 0.9.10 for some reason (see https://bugzilla.gnome.org/show_bug.cgi?id=729137) so if the server doesn't send any searches, then it appears that NM won't set either domain or search in resolv.conf.  Not sure if that's a problem.

2) system hostname - Philip's problem is that he is expecting the system hostname to be set to the DHCP hostname combined with the DHCP domain name, and NM basically discards the domain part.

NM only cares about the DHCP hostname if there isn't already a persistent hostname.  So perhaps if there is no persistent hostname, NM could combine the DHCP hostname and domain (if both are valid *and* if the hostname is not an FQDN already) and use that as the transient system hostname.  Not sure if that'll break any existing configurations that use DHCP-provided hostnames that aren't FQDNs though.
Comment 3 Philip Prindeville 2017-02-10 19:34:32 UTC
Created attachment 345478 [details]
Validated via /etc/dhcp/dhclient.d/hostname.sh script
Comment 4 Philip Prindeville 2017-02-10 21:04:14 UTC
Created attachment 345485 [details]
Corrected version of /etc/dhcp/dhclient.d/hostname.sh
Comment 5 André Klapper 2020-11-12 14:32:39 UTC
bugzilla.gnome.org is being shut down in favor of a GitLab instance. 
We are closing all old bug reports and feature requests in GNOME Bugzilla which have not seen updates for a long time.

If you still use NetworkManager and if you still see this bug / want this feature in a recent and supported version of NetworkManager, then please feel free to report it at https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/

Thank you for creating this report and we are sorry it could not be implemented (workforce and time is unfortunately limited).