ISC DHCPD 类别未分配

ISC DHCPD 类别未分配

我正在尝试设置一个启动服务器仅有的回答那些想要通过网络启动的设备。根据启动 ROM,我需要提供不同的启动映像,其他设置都是通用的。

我当前的配置(/etc/dhcp/dhcpd.conf)是:

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;
        }
}

现在,似乎没有分配该类。我也尝试使用子类来实现它,但效果相同。日志语句显示返回的字符串是正确的(并且substring()确实使用了基数 0 [未记录])。

对于一些测试,我使用了该allow dynamic bootp clients语句。结果是主机收到了一个 IP 地址,但没有文件名,这表明该类仍未分配。

答案1

我根据你的配置做了一些修改,使之看起来更像我的配置

#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";
        }
    }
}

相关内容