ddns using client's hostname
Kevin Fitzgerald
kwfitzgerald at ualr.edu
Fri May 21 13:25:50 UTC 2010
On my DHCP static reserves I generally supply the hostname option in the
reservation to ensure getting the value that I want. I would love to have
all the other machines that pull leases but do not have a reserve to use
this generated hostname based on IP address. I have many machines on my
campus that have bad hostnames, either because of bad characters or
gibberish entries. Will the ddns-hostname setting trump the hostname option
specified in my reserves?
-Kevin
On Sun, May 16, 2010 at 2:09 AM, Glenn Satchell
<glenn.satchell at uniq.com.au>wrote:
> On 05/16/10 16:03, dhcp wrote:
>
>> } -----Original Message-----
>> } From: dhcp-users-bounces+dhcp=watkins-home.com at lists.isc.org [mailto:
>> dhcp-
>> } users-bounces+dhcp=watkins-home.com at lists.isc.org] On Behalf Of Glenn
>> } Satchell
>> } Sent: Sunday, May 16, 2010 12:28 AM
>> } To: Users of ISC DHCP
>> } Subject: Re: ddns using client's hostname
>> }
>> } On 05/16/10 09:20, dhcp wrote:
>> }> Hi,
>> }>
>> }> I have dhcpd working with ddns to my bind9 server. However, I want
>> }> usable hostnames and some system don't send a hostname. I want is to
>> use
>> }> the clients hostname if one exist (from the client) or make one up if
>> }> none exists. I just can't figure out how to do this.
>> }>
>> }> I can make one up using this:
>> }>
>> }> ddns-hostname = concat("dhcp-", binary-to-ascii(10, 8, "-",
>> }> leased-address));
>> }>
>> }> But as I said, if the client supplies a hostname I want to use that.
>> }>
>> }> I know the client's hostname is in the DHCP DHCPDISCOVER message, here
>> }> is an example where the hostname is H36372437:
>> }>
>> }> May 15 19:18:16 linux dhcpd: DHCPDISCOVER from 00:12:f0:ec:e7:c4 via
>> } eth0
>> }>
>> }> May 15 19:18:17 linux dhcpd: DHCPOFFER on 192.168.0.203 to
>> }> 00:12:f0:ec:e7:c4 (H36372437) via eth0
>> }>
>> }> May 15 19:18:17 linux dhcpd: Added new forward map from
>> }> dhcp-192-168-0-203.watkins-home.com to 192.168.0.203
>> }>
>> }> May 15 19:18:17 linux dhcpd: added reverse map from
>> }> 203.0.168.192.in-addr.arpa. to dhcp-192-168-0-203.watkins-home.com
>> }>
>> }> May 15 19:18:17 linux dhcpd: DHCPREQUEST for 192.168.0.203
>> (192.168.0.2)
>> }> from 00:12:f0:ec:e7:c4 (H36372437) via eth0
>> }>
>> }> May 15 19:18:17 linux dhcpd: DHCPACK on 192.168.0.203 to
>> }> 00:12:f0:ec:e7:c4 (H36372437) via eth0
>> }>
>> }> Thanks for any help.
>> }>
>> }> Guy
>> }
>> } You could try pick-first-value(), described in the dhcp-eval man page.
>> } option fqdn.hostname and option hostname are described in dhcp-options
>> } man page. The dhcpd.conf man page describes the algorithm used by the
>> } interim DNS update scheme, which uses options fqdn.hostname and
>> hostname.
>> }
>> } Perhaps something like this:
>> }
>> } ddns-hostname = pick-first-value(
>> } option fqdn.hostname,
>> } option hostname,
>> } concat("dhcp-", binary-to-ascii(10, 8, "-", leased-address))
>> } );
>> }
>> } --
>> } regards,
>> } -glenn
>> } --
>> } Glenn Satchell | Miss 9: What do you
>> } Uniq Advances Pty Ltd, Sydney Australia | do at work Dad?
>> } mailto:glenn.satchell at uniq.com.au | Miss 6: He just
>> } http://www.uniq.com.au tel:0409-458-580 | types random stuff.
>>
>> Thanks Glenn,
>> I did find a solution and was about to answer my own email when I
>> saw your solution. I came up with this:
>>
>> if exists host-name
>> {
>> ddns-hostname = lcase (option host-name);
>> }
>> else
>> {
>> ddns-hostname = concat("dhcp-", binary-to-ascii(10, 8, "-",
>> leased-address));
>> }
>>
>> I tried to use fqdn.hostname and got errors. Not sure why. I think I
>> will
>> use your solution and use pick-first-value and try fqdn.hostname again.
>> The
>> only thing you missed was lcase. :) I hate upper case hostnames for some
>> reason.
>>
>> Thanks,
>> Guy
>>
>>
> Oh well, if fqdn.hostname doesn't work for some reason you can leave that
> line out.
>
> There was no previous mention of lcase() but I was trying to keep the
> example as simple as possible. FWIW I prefer all lower case hostnames too :)
>
> --
> regards,
> -glenn
>
>
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20100521/59906108/attachment.html>
More information about the dhcp-users
mailing list