From owner-freebsd-questions@FreeBSD.ORG Tue May 12 07:52:24 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37A2E1065678 for ; Tue, 12 May 2009 07:52:24 +0000 (UTC) (envelope-from Pieter.Donche@ua.ac.be) Received: from macos.cmi.ua.ac.be (macos.cmi.ua.ac.be [143.129.75.1]) by mx1.freebsd.org (Postfix) with ESMTP id A745F8FC12 for ; Tue, 12 May 2009 07:52:23 +0000 (UTC) (envelope-from Pieter.Donche@ua.ac.be) Received: from macos.cmi.ua.ac.be (localhost [127.0.0.1]) by macos.cmi.ua.ac.be (8.14.2/8.14.2) with ESMTP id n4C7qLqG075978; Tue, 12 May 2009 09:52:21 +0200 (CEST) (envelope-from Pieter.Donche@ua.ac.be) Received: from localhost (pdon@localhost) by macos.cmi.ua.ac.be (8.14.2/8.14.2/Submit) with ESMTP id n4C7qKV3075975; Tue, 12 May 2009 09:52:20 +0200 (CEST) (envelope-from Pieter.Donche@ua.ac.be) X-Authentication-Warning: macos.cmi.ua.ac.be: pdon owned process doing -bs Date: Tue, 12 May 2009 09:52:20 +0200 (CEST) From: Pieter Donche X-X-Sender: pdon@macos.cmi.ua.ac.be To: Matthew Seaman In-Reply-To: <4A068874.8030408@infracaninophile.co.uk> Message-ID: References: <4A068874.8030408@infracaninophile.co.uk> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "mail.list freebsd-questions" Subject: Re: isc-dhcpd server, HOSTNAME X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Pieter Donche List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 07:52:25 -0000 On Sun, 10 May 2009, Matthew Seaman wrote: > Pieter Donche wrote: >> FreeBSD7 with isc-dhcp30-server. >> It hands out an IP address, OK, >> but the BASH environment variable HOSTNAME is not set. Why? >> >> (A DNS server is active on the network and can succesfully be queried from >> a FreeBSD bash command (nslookup or host) to see the hostname associated >> with the IP-address) > > Hostname is not one of the parameters usually requested from a DHCP server > by a Unix machine. In fact, it's normally the other way round: the client > tells the DHCP server what it's hostname is and the DHCP server can then > inject an A record into the DNS dynamically. So, the normal way is that you have an entry hostname="somename.somedomain" in /etc/rc.conf ? I can't remember the details of the install of this FreeBSD7 system, set up as a DHCPclient, but is during the installation the name of the host you want this machine to have and its domainname something that is asked for? (and then recorded in /etc/rc.conf) > However it is possible to operate in the way you want. To tell the dhcp > server to look up names from the DNS based on the address supplied to a > host, search for the description of the 'get-lease-hostnames' flag in > the dhcpd.conf(5) man page. > > To tell dhcp clients to fetch their hostname from DHCP, you need to add it > to a 'request' or 'require' block in dhclient.conf -- see dhclient.conf(5). > > It's been a long time since I ran a setup anything like that, so I cannot > recall if that was all that was required, or if it was also necessary to > write a small dhclient-script(8) to actually set the hostname. > Another alternative is to use a dhclient-script to take the IP number > allocated by the DHCP server, look up the corresponding address and then > set that as the hostname. > > The bash HOSTNAME environment variable will be set from the output of the > hostname(1) command, which is usually set from the hostname variable in > /etc/rc.conf or from the output of '/bin/kenv dhcp.host-name' if that is set. > Otherwise it uses a default hostname of 'amnesiac'. > Cheers, > > Matthew > > -- > Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard > Flat 3 > PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate > Kent, CT11 9PW > >