How does DHCPD determine what IP address to assign and...

Ryan McCain Ryan.McCain at dss.state.la.us
Thu Dec 27 19:56:07 UTC 2007


Great..  That's a lot to digest.  Let me google around based on what I know now and see if I can get this figured out.


>>> On Wed, Dec 26, 2007 at  5:17 PM, in message
<a06240801c3988e7cd797 at simon.thehobsons.co.uk>, Simon Hobson
<dhcp1 at thehobsons.co.uk> wrote: 
> Ryan McCain wrote:
> 
>>The UID always looks something like this in the lease file::
>>
>>uid "\000cisco-10.116.6.251-Async32"
>>
>>Would this then be the correct syntax:?
>>
>>class "DialUp" {
>>     match if substring(option vendor-class-identifier, 3,5) = "Async";
>>         log (info, " Matched Dialup Rule");
>>}
>>
>>subnet 10.116.6.0 netmask 255.255.255.0 {
>>      pool {
>>          allow members of "DialUp";
>>          range 10.116.6.1 10.116.6.8;
>>          option routers 10.116.6.1;
>>          }
>>}
>>
>>..Am I "calling" the "DialUp" class correctly so that any UID that 
>>contains the string "Async" will be assigned an IP address between 
>>10.116.6.1 - 10.116.6.8?
> 
> Apart from what David wrote re vendor-class-identifier vs 
> dhcp-client-identifier, your match statement will NOT match.
> 
> Given that string for client-id, then substring 3,5 would return 
> "sco-1" which is not "Async". For that particular string, you would 
> need substring 20,5 - ie the 5 byte string starting at offset 20.
> 
> However, as I warned about earlier, the actual length of this string 
> will change with IP address - eg if the client-id was 
> "\000cisco-10.116.6.51-Async32" then you would need to look one byte 
> earlier. If the ending is always "Async32" then you might be better 
> using 'suffix(dhcp-client-identifier, 7)' which would return the last 
> 7 bytes.
> 
> Of course, if the 32 isn't constant, then you may well have to 
> combine multiple statements to get what you need :
> 
> ( (substring(suffix(dhcp-client-identifier,7),0,5)="Async")
>   or
>    (substring(suffix(dhcp-client-identifier,6),0,5)="Async") )
> 
> would match <anything>Asyncxx or <anything>Asyncx
> 
> 
> 
> Lastly, yes you are using the result correctly (as in 'allow members 
> of ...'), but don't forget you will also have to deny these clients 
> use of any other pools - otherwise you cannot guarantee that they 
> will use this one.



More information about the dhcp-users mailing list