Why is dhcpd not matching the MAC address as it should

Simon Hobson dhcp1 at thehobsons.co.uk
Wed Jan 17 21:34:47 UTC 2018


Andrew Falanga (afalanga) <afalanga at micron.com> wrote:

> class "controller" {
>    # tried matching based on two different styles I've seen on the net
>    #match if substring(hardware, 1, 3) = 00:a0:45;
>    match if (binary-to-ascii(16, 8, ":", substring(hardware, 0, 4)) = "1:00:a0:45");

This won't match, the string "1" (that you've used) will not match the string "01" (what binary-to-ascii will generate). Also you are comparing FIVE bytes from the MAC address to FOUR bytes in the string. What you should do is simply compare the binary values :
match if substring(hardware, 0, 3) = 1:00:a0:45;
or
match if substring(hardware, 1, 3) = 00:a0:45; (as you've shown as an alternative above)

Note: the leading "1" is the hardware type, 1 indicating Ethernet.



More information about the dhcp-users mailing list