Client tied to pool via (sub)class in one subnet, same client has host declaration in other subnet...

Simon Hobson dhcp1 at thehobsons.co.uk
Thu Sep 19 15:35:50 UTC 2013


Christian Marg wrote:
>> You have put the host declaration inside the subnet declaration.
>> When you do that, it has the side effect that it will get its router and
>> some other settings from that subnet.
>
>We actually rely on that - we have about 70 different subnets with about 
>4500 host declarations. I don't like the idea to define "option routers" 
>etc. per host...

You rely on incorrect operation ?
You do **NOT** have to define option routers for each host. Put the host declarations and class declarations in the public scope. The incorrect inheritance will stop, and each host will inherit options like routers from the subnet in which it gets an IP address.


>man dhcpd.conf says:
>====8<====8<====8<====8<====
>When a client is to be booted, its boot parameters are determined by
>consulting that client's host declaration (if any), and then consulting
>any class declarations matching the client, followed by the pool, sub-
>net and shared-network declarations for the IP address assigned to the
>client.
>====8<====8<====8<====8<====
>
>So the problem is not the placement of the host declarations but the 
>fact that the class declaration ties the host to a pool, which in turn 
>is called more "specific" than a subnet declaration...

No, the problem is that you have been told the answer but refuse to accept it !
It's a problem that's come up here before, and the fix has always been the same.


>> The general advice is to have all
>> host declarations outside all subnet declarations as they are global in
>> scope no matter where they are placed, inheritance is from where they
>> are placed.
>
>So a host declared globally will inherit the subnet parameters because 
>it's IP adress belongs to the subnet? I think we went for host 
>declarations inside of subnet declarations because it's a little more 
>intuitive.

Yes, if they worked like people expect then it would be. But they don't - so the general rules is that you do **NOT** put host statements inside subnets as it causes the sort of problems you've seen.

>> It could also look like the class and subclass declarations inherit form
>> the subnets they are placed in. I suggest to move them to outside all
>> subnets, they are global anyway.
>
>I already moved the class and subclass declaration out of the subnet - 
>no change in behaviour. Of course the pool was still in the subnet, but 
>where else would it be.

It works for others !
Be aware that some clients just don't accept changed options - you need to explicitly release and relew the lease for changes to show up.


More information about the dhcp-users mailing list