mac ddns for wake on lan

Carl Karsten carl at
Mon Dec 17 14:33:39 UTC 2007

I want to be able to use Wake On Lan without having to remember mac addresses. 
So I was thinking I could add mac to the ddns update that dhcpd does.  maybe add 
a TXT record each time, and then the WOL program can get the mac from a dns query.

How doable is this?  Looking at my dhcpd.conf I have no idea where to start.

Carl K

# dhcpd.conf
# Dynamic DNS - update the server
ddns-updates on;
ddns-update-style interim;
do-forward-updates on;
ddns-domainname "";
ddns-rev-domainname "";
update-static-leases on;
# ddns-ttl 7200;

         algorithm HMAC-MD5.SIG-ALG.REG.INT;
         secret ZiO1XpvhIDVLRsvnBk9+Qw==;

zone {
         primary localhost;
         key DHCP_UPDATER;

zone {
         primary localhost;
          key DHCP_UPDATER;

The data that is contained in a Magic Packet is the defined constant as
represented in hexadecimal: FF FF FF FF FF FF followed by sixteen
repetitions of the target computer's MAC address, possibly followed
by a four or six byte password.

import socket, sys

def wake_on_lan(ether_addr):

   s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
   s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
   s.sendto(msg, ('<broadcast>', 9))


More information about the dhcp-users mailing list