Log host identifier

Bill Shirley bill at c3po.polymerindustries.biz
Thu Oct 19 07:12:15 UTC 2017


Add logging to your dhcpd.conf.  Here is what I use:
on commit {
     if static {
         set is-static = " --> STATIC";

         option dhcp-renewal-time    = encode-int(43200 / 2, 32);    # 43200 = 12 hours
         option dhcp-rebinding-time    = encode-int(43200 * 7 / 8, 32);
         ddns-ttl            = encode-int((43200 / 2) + 1, 32);
     } else {
         set is-static = "";

         option dhcp-renewal-time    = encode-int(lease-time / 2, 32);
         option dhcp-rebinding-time    = encode-int(lease-time * 7 / 8, 32);
         ddns-ttl            = encode-int((lease-time / 2) + 1, 32);
     }

     log (   info,
         concat (
             "Host:", pick-first-value(option fqdn.hostname, option host-name, "(none)"), "=>", pick-first-value(config-option 
server.ddns-hostname, "(none)")

             ,"  VendorId:", pick-first-value(option vendor-class-identifier, "(none)")

             ,"  Lease:", pick-first-value(binary-to-ascii(10,32,"",encode-int(lease-time,32)), "(none)")
             ,"  Renewal:", pick-first-value(binary-to-ascii(10, 32, "", config-option dhcp-renewal-time), "(none)")
             ,"  Rebind:", pick-first-value(binary-to-ascii(10, 32, "", config-option dhcp-rebinding-time), "(none)")

             ,"  TTL:", pick-first-value(binary-to-ascii(10, 32, "", config-option server.ddns-ttl), "(none)")

             ,"  GIaddr:", pick-first-value(binary-to-ascii(10, 8, ".", packet(24,4)), "(none)")
             , is-static
         )
     );
}

Bill


On 10/19/2017 3:00 AM, Narcis Garcia wrote:
> isc-dhcp-server is currently logging in my system:
> DHCPDISCOVER from 11:22:33:44:55:66 via eth0
> DHCPOFFER on 172.16.20.201 to 11:22:33:44:55:66 via eth0
> DHCPREQUEST for 172.16.20.201 from 11:22:33:44:55:66 via eth0
> DHCPACK on 172.16.20.201 to 11:22:33:44:55:66 via eth0
>
> How can I make the service logs some name about that known client? (such
> as "printer_1")
>
> Thanks.
> _______________________________________________
> 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/20171019/210f4e49/attachment.html>


More information about the dhcp-users mailing list