dhcpv4, how to identify hosts by dhcp-client-identifier?
Thomas Markwalder
tmark at isc.org
Mon Dec 5 11:48:46 UTC 2016
On 12/3/16 5:21 PM, Simon Hobson wrote:
> Robert Senger <robert.senger at lists.microscopium.de> wrote:
>
>> 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
>> format.
> What you can do is simply specify a binary value to match against. So simply use (taking your example) 1:00:3a:63:b:1c:33 (note - no quotes) which means 7 bytes containing the values specified - ie 1, zero, 0x 3a, ...
>
> If you put quotes around 1:00:3a:63:b:1c:33 (ie use "1:00:3a:63:b:1c:33" in the config file) then that means 19 bytes containing 0x31 (1), 0x3a (:), 0x30 (0), 0x30 (0), 0x3a (:), 0x33 (3), and so on.
>
> If you look in the leases file, you'll see that the server can also work with a string with non-printable characters escaped - but that's not an easy format for humans to work with.
>
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users
FYI
As of 4.3.4, you can instruct both the server and client to output ID
values in hex:
The lease-id-format parameter
lease-id-format format;
The format parameter must be either octal or hex. This
parameter
governs the format used to write certain values to lease
files. With
the default format, octal, values are written as quoted
strings in
which non-printable characters are represented as octal
escapes - a
backslash character followed by three octal digits. When
the hex
format is specified, values are written as an unquoted
series of
pairs of hexadecimal digits, separated by colons.
Currently, the values written out based on lease-id-format
are the
server-duid, the uid (DHCPv4 leases), and the IAID_DUID
(DHCPv6
leases). Note the server automatically reads the values in
either
format.
This can make life easier when attempting to match values. Note that
this only influences what one sees in the lease and log files and is
done for readability. The formats do not have to be the same between
server and client, although having them both output in hex is sort of
the point.
Thomas Markwalder
ISC Software Engineering
More information about the dhcp-users
mailing list