Keep hosts Mac address

David Forrest drf at maplepark.com
Wed Dec 4 19:14:50 UTC 2013


On Wed, 4 Dec 2013, Prunk Dump wrote:

> Hello,
>
> I'm looking for a way to keep my hosts mac address in a database so I
> can power on them using their WOL capability. The DHCP server seems a
> good starting point to do this because it give or query the host-names
> and manages the leases with the mac addresses.
...
> Can anyone give me an idea ?

I use dhcp logging.  From my current dhcpd.conf:

##### new lease issued logging
on commit { if (static) {
               log (info, concat (
                 "DHCPNETMON ",
                 binary-to-ascii (10,32,"",encode-int (lease-time,32))," ",
                 substring (binary-to-ascii (16,8,":",hardware), 2,17)," ",
                 binary-to-ascii (10,8,".",leased-address)," ",
                 pick-first-value(host-decl-name, "(none)"),
                 " static"));
             } else {
               log (info, concat (
                 "DHCPNETMON ",
                 binary-to-ascii (10,32,"",encode-int (lease-time,32))," ",
                 substring (binary-to-ascii (16,8,":",hardware), 2,17)," ",
                 binary-to-ascii (10,8,".",leased-address), " ", 
pick-first-value(ddns-fwd-name,host-decl-name,host-name,"(none)"),
                 " dynamic"));
             }

and looking at the log file, it appears this might then work for you:
$ sudo grep DHCPNETMON /var/log/messages |cut -d \  -f 9,10|sort|uniq
0:c0:a8:da:94:35 192.168.102.126
28:ef:1:48:89:64 192.168.102.129
52:54:0:ae:45:1d 192.168.102.118
ec:9a:74:94:68:64 192.168.102.127
$


Dave
-- 
David Forrest        e-mail    drf at maplepark.com
Maple Park Development     http://www.maplepark.com
St. Louis, Missouri


More information about the dhcp-users mailing list