dhcpv4, how to identify hosts by dhcp-client-identifier?

Robert Senger robert.senger at lists.microscopium.de
Fri Dec 2 22:22:41 UTC 2016

Hi there,

usually, dhcpv4 clients are identified in host { } statements by their
hardware address, however, there are situations (like multiboot
machines) where it is required to use additional/other information to
identify the client. I want to use the dhcp-client-identifier, which
can easily be set individually in Linux and FreeBSD dhclient.conf
configuration file. 

If I do it like this on the server and on a *nix client machine, it
works fine:

in client's dhclient.conf:

send dhcp-client-identifier "0c3f2fd7-c75c-4c27-8757-bbd71b9e0677";

in server's dhcpd.conf:

host alderamin {                                                                                                                               
        option dhcp-client-identifier "0c3f2fd7-c75c-4c27-8757-bbd71b9e0677";                                                                  
        include "/etc/dhcp/dhcp4event.conf.inc";                                                                                               

So, in that case, in both server and client configuration, the dhcp-
client-identifier is configured as an ascii string.

However, Windows and OS X and also *nix if the quotes are omitted, do
not send the dhcp-client-identifier as an ascii string, instead, those
operating systems send their dhcp-client-identifier in some binary

Now I am in trouble, since I cannot find a way to match the sent binary
dhcp-client-identifier to anything I can put into dhcpd.conf host { }

I figured out that if I do this on dhcp-client-identifier option:

set ClientID = binary-to-ascii(16, 8, ":", option dhcp-client-identifier);

then I get a human readable string that looks reasonable, like 
"1:00:3a:63:b:1c:33" (for a Windows 10 machine, "1:<MAC>"), or 
0c3f2fd7-c75c-4c27-8757-bbd71b9e0677 (for the above *nix client, 
without quotes around the value in dhclient.conf). 

I found this in the man pages:

> Please be aware that some DHCP clients, when configured with client
> identifiers that are ASCII text, will prepend a zero to the ASCII
> text. So you may need to write:
>    option dhcp-client-identifier "\0foo"; 
> rather than:
>    option dhcp-client-identifier "foo"; 

but that does not help me, since Windows and OS X do not send ascii
strings at all. More than that, if I try to prepend "\0" to the string
as said in the man pages, dhcpd refuses to start due to config error. I
tried to prepend "\000" (octal), "\0x00" (hex), and dhcpd starts, but
will not match dhcp-client-identifier to what the client sent.

I've tried a couple of ways to match against the binary-to-ascii
converted dhcp-client-identifier option, but with no luck.

So finally, the question is:


send dhcp-client-identifier 0c3f2fd7-c75c-4c27-8757-bbd71b9e0677; # no quotes here!


host alderamin {                                                                                                                               
        option dhcp-client-identifier <What am I supposed to put here to match against binary dhcp-client-identifier?>;                                                                  
        include "/etc/dhcp/dhcp4event.conf.inc";                                                                                               

Thanks for help.



Robert Senger

More information about the dhcp-users mailing list