# Set the hostname from DHCP data if required
-# Set one of the below to override the DHCP supplied hostname information
-# to be either a short hostname or a FQDN.
-#hostname_fqdn=false
-#hostname_fqdn=true
+# A hostname can either be a short hostname or a FQDN.
+# hostname_fqdn=true
+# hostname_fqdn=false
+# hostname_fqdn=server
+
+# A value of server means just what the server says, don't manipulate it.
+# This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
+# where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
+# DHCPv6 has no hostname option.
+# RFC4702 section 3.1 says FQDN should be prefered over hostname.
+#
+# As such, the default is hostname_fqdn=true so that a consistent hostname
+# is always assigned.
+: ${hostname_fqdn:=true}
# Some systems don't have hostname(1)
_hostname()
case "$hostname_fqdn" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1) hfqdn=true;;
- "") ;;
+ [Ss][Ee][Rr][Vv][Ee][Rr]) ;;
*) hshort=true;;
esac
For example, you can force the hostname hook to always set the hostname with
.Ic env
.Va force_hostname=YES .
+.Pp
+If the hostname is set, will be will set to the FQDN if possible as per
+RFC 4702 section 3.1.
+If the FQDN option is missing,
+.Nm dhcpcd
+will still try and set a FQDN from the hostname and domain options for
+consistency.
+To override this, set
+.Ic env
+.Va hostname_fqdn=[YES|NO|SERVER] .
+A value of server means just what the server says, don't manipulate it.
+This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
+where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
+DHCPv6 has no hostname option.
.It Ic clientid Ar string
Send the
.Ar clientid .
Sends the short hostname to the DHCP server instead of the FQDN.
This is useful because DHCP servers will not register the FQDN in their
DNS if the domain part does not match theirs.
+.Pp
+Also, see the
+.Ic env
+option above to control how the hostname is set on the host.
.It Ic ia_na Op Ar iaid
Request a DHCPv6 Normal Address for
.Ar iaid .