Leasetime in class?

Tom Schmitt TomSchmitt at gmx.de
Tue Jun 19 11:46:40 UTC 2007


Hi,

I use the ISC-dhcpd 3.0.5 and have a problem to understand its behaviour.

I have PXE-clients and want to give a different (shorter) leasetime to the PXE-NICs than I give to the PCs themself.

My solution was to write a class for PXE with a different leasetime.

This is my config:



authoritative;
ddns-const-dhcid;
ddns-update-style interim;
ddns-updates true;
update-optimization false;
update-static-leases false;
deny declines;
min-lease-time 43199;
default-lease-time 43200; # 12 hours
max-lease-time 43201; 
lease-file-name "/var/dhcp/dhcpd.leases";
log-facility local7;
omapi-key SECRETKEY;
omapi-port 7911;
pid-file-name "/var/dhcp/dhcpd.pid";
ping-check true;
deny client-updates;

class "PXE" {
    match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
       min-lease-time 238;
       default-lease-time 239;
       max-lease-time 240; # 4 minutes
       log (info, " * * * * * __________Matched PXE__________ * * * * *");
}
subnet 192.168.0.0 netmask 255.255.255.0 {
        option broadcast-address 192.168.0.255;
        option domain-name "mydomain.local";
        option routers 192.168.0.1;
        option ntp-servers 192.168.0.1;
        option subnet-mask 255.255.255.0;
        option domain-name-servers 192.168.0.1;
        option netbios-name-servers 192.168.0.2;
        if substring(option vendor-class-identifier, 0, 9) = "PXEClient"
        {
                log (info, "Matched PXE too");
                next-server 192.168.0.2;
                option tftp-server-name "192.168.0.2";
                option dhcp-server-identifier 192.168.0.2;
                option vendor-class-identifier "PXEClient";
    #            min-lease-time 238;
    #            default-lease-time 239;
    #            max-lease-time 240; #vier Minuten
        }
        pool
        {
             deny dynamic bootp clients;
             range 192.168.0.10 192.168.0.200;
        }
}
key SECRETKEY {
        algorithm hmac-md5;
        secret "secret";
}
zone mydomain.local. {
        primary 192.168.0.1;
}
zone 0.168.192.in-addr.arpa. {
        primary 192.168.0.1;
        key dhcp;
}
subnet 127.0.0.0 netmask 255.0.0.0
{
        option broadcast-address 127.255.255.255;
        option domain-name-servers 127.0.0.1;
        option ntp-servers 127.0.0.1;
        option routers 127.0.0.1;
        option subnet-mask 255.0.0.0;
}



The log-line in the class-statement has the purpose that I can see in the logfile wether the class-statement was used or not.

When a PXE-client is booting I see the log-line in the log-file, so I assume, that the class-statement was actually used as expected.
But: If I have a look into the lease-database I see, that the leasetime for the PXE-client is still 12 hours and not 4 minutes! Why?

If I delete the class-statement and put the leasetime-lines into the pxe-statement in the subnet (in fact deleting the # you see above), it is working as expected:
The PXE-client actually gets a 4-minute-lease.

But why isn't it working with the leasetime-lines in the class-statement? Thats what I don't understand.

And of course it would be nicer to solve this with a class, because otherwise I have to add these lines in every subnet I have.

Maybe somone can help me here?
Bye,
Tom
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer


More information about the dhcp-users mailing list