2

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.

Daniel Alder
  • 533
  • 1
  • 8
  • 19
  • Where's the next-server statement that tells it where to grab the file? –  Aug 18 '15 at 17:49
  • This will come later (with a bunch of other settings like dns etc.). For first, I want to keep the example as simple as possible. (Some pages also say it's `server-name` not `next-server` which is used as tftp server) – Daniel Alder Aug 19 '15 at 07:32

1 Answers1

1

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";
        }
    }
}
  • Could you please go over a bit what changes you made and why? – Colyn1337 Aug 26 '15 at 18:33
  • @Colyn1377 The line with "d0:39:72" filters the macs down to Texas Instruments devices which will always be used by the bootrom. The allow dynamic bootp clients; is required for the bootp process. The line with "AM335x U-Boot SPL" might need to be moved to its own pool since its possible to u-boot to change the mac at this stage though. Also this allows the proper files to be transfered since its not in the class discovery part – Neil Hellfeldt Aug 26 '15 at 22:19