mac ddns for wake on lan

Jeffrey Hutzelman jhutz at cmu.edu
Sun Jan 6 11:14:25 UTC 2008



--On Monday, December 17, 2007 12:16:02 PM -0600 "Stulic,Damjan" 
<damjan.stulic at edwardjones.com> wrote:

> If you decide to keep original hostname, you can log the mac and use
> some kind of swatch/syslog-ng process to trigger different events
> (updates to dns). Like (in pool declaration):
>    on commit {
>      log(error, concat ("mac ",NAM);
>    }

In fact, you can do one better than this and issue an additional DDNS 
update directly from the trigger to create the TXT record you want, 
something like this:

on commit {
  set MAC = binary-to-ascii (16, 8, "", substring(hardware, 1, 6);
  set r = ns-update(delete (IN, TXT, host-decl-name, null),
                    add    (IN, TXT, concat("MAC:",MAC)));
}

Note that this will remove _all_ TXT records for that name, leaving only 
the new record containing the client's MAC address.  It also doesn't cause 
that record to be removed when the lease is released; if you want that 
you'll have to add an additional trigger for that case.

This assumes that host-decl-name will be a fully-qualified name; if that is 
not the case, then you'll have to construct one for use in the ddns update.

-- Jeffrey T. Hutzelman (N3NHS) <jhutz+ at cmu.edu>
   Carnegie Mellon University - Pittsburgh, PA



More information about the dhcp-users mailing list