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

Simon Hobson dhcp1 at
Wed Dec 26 23:17:16 UTC 2007

Ryan McCain wrote:

>The UID always looks something like this in the lease file::
>uid "\000cisco-"
>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 netmask {
>      pool {
>          allow members of "DialUp";
>          range;
>          option routers;
>          }
>..Am I "calling" the "DialUp" class correctly so that any UID that 
>contains the string "Async" will be assigned an IP address between 
> -

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-" 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")
   (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