Description of problem:
If DHCP_HOSTNAME contains a FQDN, dhclient is invoked with the -H
option passing the full FQDN. This seems to be wrong according to the
dhclient man page, which states that the argument of -H should be the
Specify the host-name option to send to the DHCP server.
The host-name string only contains the client's hostname
prefix, to which the server will append the
ddns-domainname or domain-name options, if any, to
derive the fully qualified domain name of the client.
The -H option cannot be used with the -F option.
Specify the fqdn.fqdn option to send to the DHCP server.
This option cannot be used with the -H option. The
fqdn.fqdn option must specify the complete domain name
of the client host, which the server may use for dynamic
Version-Release number of selected component (if applicable):
Steps to Reproduce:
# grep DHCP_HOSTNAME /etc/sysconfig/network-scripts/ifcfg-eth0-dhcp
# ifup eth0-dhcp
Determining IP information for eth0... done.
# ps ax | grep [d]hclient
6197 ? Ss 0:00 /sbin/dhclient -H foo.bar.com -1 -q [...]
dhclient should not be invoked with -H and a FQDN.
I think this was introduce with commit
with the intention of stripping both HOSTNAME and DHCP_HOSTNAME, but
since expand_config() is not called with DHCP, the result is that only
HOSTNAME gets stripped.
I noticed this behavior while analyzing NetworkManager's bug 1255507.
The reporter asks for a way to send the FQDN as hostname, while in
NetworkManager currently we strip both system hostname and
DHCP_HOSTNAME and then use the -H option of dhclient.
In my opinion the correct behavior for both NetworkManager and
initscripts would be to avoid stripping HOSTNAME and DHCP_HOSTNAME and
to use the -F dhclient option when the hostname we are going to send
is a fully-qualified one.
What do you think about it? Please see bug 1255507 for more details.
DHCP_HOSTNAME should not be FQDN, it was always supposed to be short hostname, which should be fine for the -H. The intention of the patch you mentioned was to guarantee that, but it was messed up. The second part should be in source_config function, not in expand_config.
> In my opinion the correct behavior for both NetworkManager and
> initscripts would be to avoid stripping HOSTNAME and DHCP_HOSTNAME and
> to use the -F dhclient option when the hostname we are going to send
> is a fully-qualified one.
That would break for those who are specifying here a short hostname.
I think that correct solution here is to add a new DHCP_FQDN_HOSTNAME variable.
(In reply to Lukáš Nykrýn from comment #2)
> > In my opinion the correct behavior for both NetworkManager and
> > initscripts would be to avoid stripping HOSTNAME and DHCP_HOSTNAME and
> > to use the -F dhclient option when the hostname we are going to send
> > is a fully-qualified one.
> That would break for those who are specifying here a short hostname.
When the hostname is short the -H option would be used, as it is
now. But yeah, for those using a FQDN there would be a change in
behavior since dhclient would start to send -F instead of -H.
> I think that correct solution here is to add a new DHCP_FQDN_HOSTNAME
Sounds good to me. And since -F and -H are mutually exclusive, when
both DHCP_HOSTNAME and DHCP_FQDN_HOSTNAME are present the latter
should be used. If none is present the system hostname probably should
be always sent with -H (to preserve backwards compatibility).
Since the variables are shared between IPv4 and IPv6, it is not
possible to use different options for the two, but probably this is
not a big limitation.
FYI, in NetworkManager 1.2 a new DHCP_FQDN ifcfg-rh variable will be supported for setting the qualified domain name to send to DHCP server. See bug 1255507 for reference.
Can we expect this update to be added to Red Hat Enterprise Linux 7.3?
Pull request accepted:
This is now part of RHEL-7 branch:
initscripts-9.49.39-1.el7 verified by TC
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, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.