Host declarations in different ranges within the same subnet

Simon Hobson dhcp1 at thehobsons.co.uk
Tue Jun 12 16:31:53 UTC 2012


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

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.


More information about the dhcp-users mailing list