Question regarding classes

Jeffrey Hutzelman jhutz at cmu.edu
Wed May 20 14:30:00 UTC 2009


--On Wednesday, May 20, 2009 09:30:57 AM +0200 Tor Houghton 
<torh+dhcp-hackers at bogus.net> wrote:

> I have a number of similar clients (phones) with the same vendor-id, but
> they exist on different subnets.
>
> How can I best set subnet-specific options for these classes?
>
> I thought I would be able to define a bunch of "class" defines:
>
> class "Phones-Subnet1" {
>  match if substring (option vendor-class-identifier, 0, 3) = "SOFT";
>  option soft-option "ip1=10.0.0.1;ip2=10.0.0.2;";
> }
>
> class "Phones-Subnet2" {
>  match if substring (option vendor-class-identifier, 0, 3) = "SOFT";
>  option soft-option "ip1=10.1.0.1;ip2=10.1.0.2;";
> }
>
> class "Phones-Subnet3" {
>  match if substring (option vendor-class-identifier, 0, 3) = "SOFT";
>  option soft-option "ip1=10.2.0.1;ip2=10.2.0.2;";
> }
>
> and then use a number of "shared-network" definitions, so:
>
> shared-network "subnet1" {
>  subnet 10.0.0.0 netmask 255.255.255.0 {
>  option subnet-mask 255.255.255.0;
>  option routers 10.0.0.254;
>  default-lease-time 28800;
>  max-lease-time 86400;
>    pool {
>       range 10.0.0.64 10.0.0.128;
>       allow members of "Phones-Subnet1";
>    }
>  }
> }
>
> shared-network "subnet2" {
>  subnet 10.1.0.0 netmask 255.255.255.0 {
>  option subnet-mask 255.255.255.0;
>  option routers 10.0.0.254;
>  default-lease-time 28800;
>  max-lease-time 86400;
>    pool {
>       range 10.1.0.64 10.1.0.128;
>       allow members of "Phones-Subnet2";
>    }
>  }
> }
>
> shared-network "subnet3" {
>  subnet 10.2.0.0 netmask 255.255.255.0 {
>  option subnet-mask 255.255.255.0;
>  option routers 10.2.0.254;
>  default-lease-time 28800;
>  max-lease-time 86400;
>    pool {
>       range 10.2.0.64 10.2.0.128;
>       allow members of "Phones-Subnet3";
>    }
>  }
> }
>
> However, this does not appear to work (perhaps I missed something
> important in the documentation ..); all networks are given options from
> the Phones-Subnet1 class (I guess, first match ..).
>
> What would the best work-around be?

Don't declare separate classes; you don't need it for this case, and it's 
getting in your way.  Use one class, but move the subnet-specific options 
to the subnets, where they belong.



More information about the dhcp-hackers mailing list