ISC DHCPD class is not assigned

dhcp-serverisc-dhcp

I'm trying to setup a boot server which only answers to devices which want to boot over the network. Depending on the boot rom, I need to deliver different boot images, the other settings are common.

My current configuration (/etc/dhcp/dhcpd.conf) is:

ddns-update-style none;
default-lease-time 60;
max-lease-time 100;
log-facility local7;

class "DM814x ROM" {
        match if substring (option vendor-class-identifier, 0, 10) = "DM814x ROM";
        filename "u-boot-spl-debrick.bin";
}
class "AM335x U-Boot SPL" {
        match if substring (option vendor-class-identifier, 0, 17) = "AM335x U-Boot SPL";
        filename "u-boot-debrick.img";
}
# more possible strings: "PXEClient", "Etherboot"

log (error,
    concat ("TEST DUMP:"
    , " mac=", binary-to-ascii(16, 8, ":", substring(hardware, 1, 6))
    , " substr='", substring (option vendor-class-identifier, 0, 10), "'"
    , " vendor='", option vendor-class-identifier, "'"
    #, " dhcpvendor='", option dhcp-vendor-identifier, "'"
    )
);

subnet 10.0.42.0 netmask 255.255.255.0 {
        #server-name "10.0.42.1";
        #option routers 10.0.42.1;
        #option domain-name "example.org";
        #option domain-name-servers ns1.example.org, ns2.example.org;
        pool {
                range 10.0.42.200 10.0.42.240;
                allow members of "DM814x ROM";
                allow members of "AM335x U-Boot SPL";
                #allow dynamic bootp clients;
        }
}

Now, it seems that the class is not assigned. I also tried to implement it using subclasses but with the same effect. The log statement showed me that the returned string is correct (and substring() really uses base 0 [which is not documented]).

For some tests I used the allow dynamic bootp clients statement. The result was that the host received an ip address but without the file name which shows that the class was still not assigned.

Best Answer

I took what I saw from your config and adapted it to what mine sort of looks like

#change next-server to your ip
next-server 10.0.42.1;

ddns-updates off;
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;

log-facility local7;

class "DM814X_MACS" {
    match if (binary-to-ascii(16,8,":",substring(hardware, 1, 3)) = "d0:39:72");
}

subnet 10.0.42.0 netmask 255.255.255.0 {
    pool {
        allow dynamic bootp clients;
        allow members of "DM814X_MACS";
        range dynamic-bootp 10.0.42.200 10.0.42.240;
        if substring (option vendor-class-identifier, 0, 10) = "DM814x ROM" {
            filename "u-boot-spl-debrick.bin";
        } elsif substring (option vendor-class-identifier, 0, 17) = "AM335x U-Boot SPL" {
            filename "u-boot-debrick.img";
        }
    }
}
Related Topic