From owner-freebsd-questions@FreeBSD.ORG Sun May 10 07:55:44 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 C5AD8106564A for ; Sun, 10 May 2009 07:55:44 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 4814E8FC0A for ; Sun, 10 May 2009 07:55:44 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.3/8.14.3) with ESMTP id n4A7tcNQ090064; Sun, 10 May 2009 08:55:39 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.2 smtp.infracaninophile.co.uk n4A7tcNQ090064 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1241942139; bh=G6V+Ggu1wegGYPraVsAwnrgoatCRrcKXb5Rt/DOADWg=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Cc:Content-Type:Date:From:In-Reply-To: Message-ID:Mime-Version:References:To; z=Message-ID:=20<4A068874.8030408@infracaninophile.co.uk>|Date:=20S un,=2010=20May=202009=2008:55:32=20+0100|From:=20Matthew=20Seaman= 20|Organization:=20Infracaninophi le|User-Agent:=20Thunderbird=202.0.0.21=20(X11/20090420)|MIME-Vers ion:=201.0|To:=20Pieter=20Donche=20|CC:=20 "mail.list=20freebsd-questions"=20| Subject:=20Re:=20isc-dhcpd=20server,=20HOSTNAME|References:=20|In-Reply-To:= 20|X-Enigm ail-Version:=200.95.6|Content-Type:=20multipart/signed=3B=20micalg =3Dpgp-sha256=3B=0D=0A=20protocol=3D"application/pgp-signature"=3B =0D=0A=20boundary=3D"------------enigA239BF2CA9A45A6903F51EB1"; b=ge3LxZuB6LtGcVdqpZ0tjamCZaTErCqrJhEK/xk9YB8APnMae9iTg2lj5BWsaarl9 70tUc2Mx629Lr7s7rI1AHZA9GudaQLCL7iF8SY5/5A+D29cVv4bxUSmnxp7hFsne/I TIMADxDxdqlGhn4TQFEuci1cs9sve4clutYfDR2g= X-Authentication-Warning: happy-idiot-talk.infracaninophile.co.uk: Host localhost [IPv6:::1] claimed to be happy-idiot-talk.infracaninophile.co.uk Message-ID: <4A068874.8030408@infracaninophile.co.uk> Date: Sun, 10 May 2009 08:55:32 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.21 (X11/20090420) MIME-Version: 1.0 To: Pieter Donche References: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigA239BF2CA9A45A6903F51EB1" X-Virus-Scanned: clamav-milter 0.95.1 at happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk 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 List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 07:55:45 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA239BF2CA9A45A6903F51EB1 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable 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? >=20 > (A DNS server is active on the network and can succesfully be queried=20 > from a FreeBSD bash command (nslookup or host) to see the hostname=20 > associated with the IP-address) Hostname is not one of the parameters usually requested from a DHCP serve= r by a Unix machine. In fact, it's normally the other way round: the clien= t tells the DHCP server what it's hostname is and the DHCP server can then inject an A record into the DNS dynamically. 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 i= t 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.=20 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=20 is set. Otherwise it uses a default hostname of 'amnesiac'.=20 Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enigA239BF2CA9A45A6903F51EB1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkoGiHoACgkQ8Mjk52CukIxgGACcCWDzeDfvKhmalRbMzhQrTZF+ cLAAn1uzX45+gZW4dua59kw8+pLlPim+ =mAPN -----END PGP SIGNATURE----- --------------enigA239BF2CA9A45A6903F51EB1--