SV: lease limits, classes & subclasses

Lars Jacobsen lars-jacobsen at newmail.dk
Thu Mar 15 19:55:41 UTC 2007


> G. Coles wrote:
> 
> what i'm trying to do (hopefully this can be done) is to classify dhcp
> clients into 2 types: example:
> 1st type: takes 'lease limit 1;'
> 2nd type: takes 'lease limit 4;'
> 
> now the only thing I can use in my scenario to classify clients is the
> option agent.remote-id
> 

Ok how is the struckture af the RID ? 
To me it looks like you are using MAC addresses.

If they are all random then I guess you have to add them one by one,
something like this:


class "limmited-to-1-lease" {
            match if substring (option agent.remote-id , 0, 17);
            lease limit 1;
        }
        subclass "limmited-to-1-lease" "XX:XX:XX:XX:XX:XX; 
        subclass "limmited-to-1-lease" "YY:YY:YY:YY:YY:YY";


class "limmited-to-2-lease" {
            match if substring (option agent.remote-id , 0, 17);
            lease limit 2;
        }
        subclass "limmited-to-2-lease" "ZZ:ZZ:ZZ:ZZ:ZZ:ZZ; 
       

class "limmited-to-4-lease" {
            match if substring (option agent.remote-id , 0, 17);
            lease limit 4;
        }
        subclass "limmited-to-4-lease" "AA:AA:AA:AA:AA:AA;
        subclass "limmited-to-4-lease" "BB:BB:BB:BB:BB:BB;
        subclass "limmited-to-4-lease" "CC:CC:CC:CC:CC:CC;



Othervice if all the RID´s have something in common like the first 3 bytes
you can do a match on just that part instead of the whole RID to match a
class and then use spawning to make a unique class for each RID.


class "XX:XX:XX" {
match if  substring ( (option agent.remote-id) , 0,8)= "XX:XX:XX";
spawn with option agent.remote-id;
lease limit 4;     
}


class "ZZ:ZZ:ZZ:01-to-ZZ:ZZ:ZZ:02" {
match if  substring ( (option agent.remote-id) , 0,8)= "ZZ:ZZ:ZZ" AND 
(substring ( (option agent.remote-id) , 8,2)= "01" OR
substring ( (option agent.remote-id) , 8,2)= "02");
spawn with option agent.remote-id;
lease limit 1;     
}


class "AA:BB:CC:01-to-AA:BB:CC:04" {
match if  substring ( (option agent.remote-id) , 0,8)= "AA:BB:CC" AND 
(substring ( (option agent.remote-id) , 8,2)= "01" OR
substring ( (option agent.remote-id) , 8,2)= "02"
substring ( (option agent.remote-id) , 8,2)= "03"
substring ( (option agent.remote-id) , 8,2)= "04");
spawn with option agent.remote-id;
lease limit 2;     
}



I made a little description on my own problems and how I solved them.
You can find it here:
www.strammelse.dk/dhcp


Regards

/Lars



More information about the dhcp-users mailing list