Structure of dhcpd.conf file and Imbricated allow

Olivier Bax de Keating olivier.baxdekeating.external at aastra.com
Thu Apr 17 13:36:08 UTC 2008


Hello,

 

I'm working on the structure of a dhcpd.conf file, and I'm having
troubles to optimize it. To understand my problem, here is a sample of
what I'm trying to do:

 

# Declaration of 2 classes

class "Type1Devices" {

  match if substring (option vendor-class-identifier, 0, 4) =
"Provider1";

  # options to give device of type 1, independently from the subnet
(like a file name to get)

}

 

class "Type2Devices" {

  match if substring (option vendor-class-identifier, 0, 4) =
"Provider2";

  # options to give device of type 2, independently from the subnet
(like a file name to get)

 

}

 

# Subnet declaration (I may have many with the same structure)

subnet 192.168.1.0 netmask 255.255.255.192 {

   allow members of "Type1Devices";

   allow members of "Type2Devices";

   # options to give to allowed members independently from the type
(like router and gateway), but dependening on the subnet

  range 192.168.0.2 192.168.0.62;

  if substring (option vendor-class-identifier, 0, 4) = "Provider1"{

      #options to give to devices of type 1 in the context of this
subnet (like a tftp server name ...)

  }

  if substring (option vendor-class-identifier, 0, 4) = "Provider2"{

      #options to give to devices of type 2 in the context of this
subnet (like a tftp server name ...)

  }

}

 

I'd like to avoid the repetition of the condition  : if substring
(option vendor-class-identifier, 0, 4) = "Provider1" which is already in
the class declaration.

I had a look to the pool declaration, with the allow members of
"Type1Devices". It solves the problem of the repetition (see below), but
I have to declare 2 ranges, one for each pool. 

 

subnet 192.168.1.0 netmask 255.255.255.192 {

   allow members of "Type1Devices";

   allow members of "Type2Devices";

   #options to give to allowed members independently from the type (like
router and gateway)

   pool{

allow members of "Type1Devices";

range 192.168.0.2 192.168.0.31;

      #options to give to devices of type 1 in the context of this
subnet (like a tftp server name ...)

   }

   pool{

      allow members of "Type2Devices";

range 192.168.0.32 192.168.0.62;

      #options to give to devices of type 2 in the context of this
subnet (like a tftp server name ...)

}

 

 

This is smthg I don't want to do because I don't know how many devices
of type1 and type2 I'll have in the subnet. So I'm searching a way (type
of declaration, or condition) which allows to use the allow on the base
on an already declared class (instead of repeating the whole if
condition in each subnets), without having to declare a range for
devices of type1 and another one for devices of type2.

 

This should look like this

 

subnet 192.168.1.0 netmask 255.255.255.192 {

   allow members of "Type1Devices";

   allow members of "Type2Devices";

   range 192.168.0.2 192.168.0.62;

 

   #options to give to allowed members independently from the type (like
router and gateway)

   if is member of "Type1Devices" {

      #options to give to devices of type 1 in the context of this
subnet (like a tftp server name ...)

   }

   if is member of "Type2Devices" {

      #options to give to devices of type 2 in the context of this
subnet (like a tftp server name ...)

   }

}

 

 

Thx for all

 

Best regards

 

Olivier Bax de Keating

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20080417/a97ec044/attachment.html>


More information about the dhcp-users mailing list