NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: FQDNs for netbooted hosts via DHCP?



    Date:        Sat, 14 Jul 2018 11:14:19 -0500 (CDT)
    From:        "John D. Baker" <jdbaker%mylinuxisp.com@localhost>
    Message-ID:  <Pine.NEB.4.64.1807141058390.1477%spike.technoskunk.fur@localhost>

  | On Sat, 14 Jul 2018, Robert Elz wrote:
  |
  | > 	env force_hostname=YES
  |
  | Yes, that's the ticket.

Good.

  | I also needed to set "use-host-decl-names true;" in "dhcpcd.conf".

In dhcpd.conf I assume.

  | Some netbooted hosts would get their hostname without this, but most would
  | not, ending up with "localhost".

As with most client/server systems, there are two separate things that need
to be made to work - the server has to send the data that you want it to
send (which might mean altering what the client requests, or server config,
or ...) and then the client needs to "do the right thing" with the data that is
returned.

Lastly, for this, I wonder if perhaps that final "false" in need_hostname
(in dhcpcd-hooks/30-hostname) might instead be something more like

	${hfqdn} && [  "${hostname}" = "${hostname#*.}" ]

so that (If I got that correct) if we want a FQDN as the hostname, and
what has been set (by something else) is not a FQDN but just a short
name, then we allow dhcpcd to set the FQDN (overriding whatever was
set before).   If it had been this way, the force_hostname stuff would not
have been needed.

If that change is mde though it would  need to be made clear that
(as the default is to set a FQDN) that simply setting a short hostname
in rc.conf would not be effective, dhcpcd.conf would also need to be
modified to allow short names if the DHCP server returns names.

Roy: I'd also suggest getting rid of the '-a' operator in test arg lists,
while it is probably OK in all systems as used, it is not really
safe - test with more than 4 args (not counting the ']' when present)
produces unspecified results.  Use && instead.   There are two of
them in that script (well, the same one, more or less, in
need_hostname() and set_hostname())

kre



Home | Main Index | Thread Index | Old Index