Logging host-name and hardware

Wayne testcat2003 at yahoo.com
Fri Jan 9 15:50:47 UTC 2009


Thanks Ray 
Both of you suggestions look like they are working.

Wayne

--- On Thu, 1/8/09, Ray Phillips <r.phillips at jkmrc.com> wrote:
From: Ray Phillips <r.phillips at jkmrc.com>
Subject: Re: Logging host-name and hardware
To: "Users of ISC DHCP" <dhcp-users at lists.isc.org>
Date: Thursday, January 8, 2009, 1:08 AM

Wayne:

> I am working on logging option82 information for requests. I would like to
just have one line that gives the option82 information, lease time, IP address,
hardware address, and host-name if the client has it set. Currently I am using.
> 
> if exists agent.remote-id
>         {
>         log ( info, concat( "lease,", binary-to-ascii (10, 8,
".", leased-address),",",
>         "agent,",option agent.remote-id,",",
>         "time,",binary-to-ascii(10,32,"",encode-int
(lease-time,32)),",",
>        
"hardware,",binary-to-ascii(16,8,":",substring(hardware,1,7))
>          ) );
> 
> This gives me
> lease,192.168.11.250,agent,0003,time,600,hardware,0:1e:a:db:58:4f
> 
> I would like to see the hardware address get formatted with
XX:XX:XX:XX:XX:XX currently if the hex value starts with 0 if gets dropped.

This piece of configuration-file code (courtesy of Glenn [1]) inserts the
leading 0 when required:

concat (
      suffix (concat ("0", binary-to-ascii (16, 8, "",
        substring (hardware, 1, 1))),2), ":",
      suffix (concat ("0", binary-to-ascii (16, 8, "",
        substring (hardware, 2, 1))),2), ":",
      suffix (concat ("0", binary-to-ascii (16, 8, "",
        substring (hardware, 3, 1))),2), ":",
      suffix (concat ("0", binary-to-ascii (16, 8, "",
        substring (hardware, 4, 1))),2), ":",
      suffix (concat ("0", binary-to-ascii (16, 8, "",
        substring (hardware, 5, 1))),2), ":",
      suffix (concat ("0", binary-to-ascii (16, 8, "",
        substring (hardware, 6, 1))),2)
)


> Also I can't figure out how to extract the host-name.

I'm not too confident about this but I use this code to assign DNS names to
hosts which don't provide a name to the dhcp server:

option server.ddns-hostname = pick-first-value (
  option fqdn.hostname,
  option host-name,
  concat (
    "nn-",
#    suffix (concat ("0", binary-to-ascii (16, 8, "",
#      substring (hardware, 1, 1))),2), "-",
#    suffix (concat ("0", binary-to-ascii (16, 8, "",
#      substring (hardware, 2, 1))),2), "-",
#    suffix (concat ("0", binary-to-ascii (16, 8, "",
#      substring (hardware, 3, 1))),2), "-",
    suffix (concat ("0", binary-to-ascii (16, 8, "",
      substring (hardware, 4, 1))),2), "-",
    suffix (concat ("0", binary-to-ascii (16, 8, "",
      substring (hardware, 5, 1))),2), "-",
    suffix (concat ("0", binary-to-ascii (16, 8, "",
      substring (hardware, 6, 1))),2)
  )
);


so perhaps you need  option fqdn.hostname



Ray



[1]  http://marc.theaimsgroup.com/?l=dhcp-server&m=105689607527110&w=2
_______________________________________________
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/20090109/257776dd/attachment-0001.html>


More information about the dhcp-users mailing list