Host declarations in different ranges within the same subnet

Glenn Satchell glenn.satchell at uniq.com.au
Wed Jun 13 00:19:03 UTC 2012


Normally you would put the option declarations inside the pool, and the
host statements in the global space. "group" is meant for grouping subnets
and other options, so not sure how it will go inside a subnet.

Following your other comments, putting the host statements in the subnet
or pool is not going to do what you want.

Create a class for each pool, and use subclasses to add members based on
the hardware ethernet address. There is an example in the dhcpd.conf man
page.

class "class100" {
    match pick-first-value (option dhcp-client-identifier, hardware);
}
class "class200" {
    match pick-first-value (option dhcp-client-identifier, hardware);
}
subclass "class100" 1:00:00:00:00:00:01;
subclass "class100" 1:00:00:00:00:00:02;
subclass "class200" 1:00:00:00:00:00:03;
subclass "class200" 1:00:00:00:00:00:04;

shared-network foo {
     subnet 10.0.0.0 netmask 255.255.255.0 {
         pool {
             allow members of "class100";
             option routers 10.0.0.100;
             option blah;
             range 10.0.0.1 10.0.0.10;
         }
         pool {
             allow members of "class200";
             option routers 10.0.0.200;
             option argh;
             range 10.0.0.11 10.0.0.20;
         }
     }
     subnet 10.1.1.0 netmask 255.255.255.0 {
         ....
     }

regards,
-glenn

> Marcio Merlone wrote:
>
>>Quick and dirty question: is it possible to have host declarations
>>with different ranges within the same subnet like this?
>>
>>shared-network foo{
>>     subnet 10.0.0.0 netmask 255.255.255.0 {
>>
>>         group {
>>             option routers 10.0.0.100;
>>             option blah;
>>             pool {
>>                 range 10.0.0.1 10.0.0.10;
>>             }
>>             host bar1 { hardware-ethernet 00:00:00:00:00:01; }
>>             host bar2 { hardware-ethernet 00:00:00:00:00:02; }
>>         }
>>
>>         group {
>>             option routers 10.0.0.200;
>>             option argh;
>>             pool {
>>                 range 10.0.0.11 10.0.0.20;
>>             }
>>             host bar3 { hardware-ethernet 00:00:00:00:00:03; }
>>             host bar4 { hardware-ethernet 00:00:00:00:00:04; }
>>         }
>>
>>     }
>>
>>     subnet 10.1.1.0 netmask 255.255.255.0 {
>>         ....
>>     }
>>}
>
> Yes it's possible - though not sure about putting pool declaration in
> there.
>
>>Will it work as expected?
>
> That depends on what you expect !
> If you expect that when host (say) bar1 connects to a completely
> different subnet then it will still get options from the 10.0.0.0
> subnet - including the router that won't be any use to it - then yes,
> it will work as expected.
> If you expect bar1 to be able to connect in any subnet and work, then
> no it won't work as expected.
> Also, if you have any expectation that the host statements would in
> any way whatsoever tie the hosts to a subnet or range, then no that
> won't do what you expect.
>
>
> It is this element of unexpected (and almost certainly unwanted)
> option inheritance that leads to the general advice to never put host
> statements within a subnet declaration.
>
> It's more likely that you'd want to use classes (see the man page
> section on classes and subclasses) :
> class "group1" ...
> class "group2" ...
> subnet ...
>    range ...
>      option routers ... # not too sure about this one
>      allow members of class1
>    range ...
>      option routers ... # not too sure about this one
>      allow members of class2
>
> --
> Simon Hobson
>





More information about the dhcp-users mailing list