Host declarations are GLOBAL (was: Query on default gateway with DHCP vs Static address)

Simon Hobson dhcp1 at thehobsons.co.uk
Fri Mar 19 18:42:10 UTC 2021


Peter Yardley <peter.martin.yardley at gmail.com> wrote:

> I used to configure subnets like this …
> 
> subnet 10.20.50.0 netmask 255.255.254.0 {
>    option subnet-mask 255.255.254.0;
>    option broadcast-address 10.20.51.255;
>    option routers 10.20.50.1;
> 
>    pool {
>        # A device for Blah
>        host HMTXYZ           { hardware ethernet 00:40:9d:54:4c:c7;
>                                        fixed-address 10.20.50.32; }
>> 
>        range 10.20.51.0 138.25.51.254;
>    }

For the benefit of anyone finding this thread later ...


DO NOT put host statements in anything other than the global scope (or a group that is within the global scope). Especially, do not put them inside a subnet declaration.

Yes, that is a **DO NOT**

Why ? They are treated as global in scope by the server, but inherit properties from where they are defined. What this means is that you can declare a host within one subnet, but that declaration is valid if the device moves to another network. So the device could get an address in the network to which it is attached, but inherit options from where it is defined. Since these inherited options include the router - which will not be valid on any other network - this is highly unlikely to be what you want. I'm sure there may be some esoteric configuration where that's useful, but AFAIK no-one has every come up with one on this list.
I think you might be able to imagine how "interesting" it would be to debug why a client is getting a router that's not in it's own subnet :D

So just don't do it<period>


Of course, with a single network and single subnet, this problem will be masked. But then you add another network, move some clients, and chaos ensues.


Simon


More information about the dhcp-users mailing list