shared subnet declaration behavior between 2 pools

Simon Hobson dhcp1 at thehobsons.co.uk
Mon Oct 9 20:35:29 UTC 2017


On 9 Oct 2017, at 21:10, project722 <project722 at gmail.com> wrote:

> Hello. im curious as to how dhcpd determines what pool to pull a lease from in a shared subnet declaration. for ex on our server we have:
> 
> shared-network "Market 1" {
>         option domain-name "example.com";
>                 subnet 192.168.1.0 netmask 255.255.255.0 {
>                 option broadcast-address 192.168.1.255;
>                 option routers 192.168.1.1;
>                 pool {
>                      
>                      
>                        failover peer "dhcp-failover";
>                        range 192.168.1.10 192.168.1.254;
>                      
>         }
>         subnet 192.168.2.0 netmask 255.255.255.0 {
>                 option broadcast-address 192.168.2.255;
>                 option routers 192.168.2.1;
>                 pool {
>                         
>                         failover peer "dhcp-failover";
>                         range 192.168.2.10 192.168.2.254;
>                         
>                         
>                }
> }
> 
> I would suspect that the broadcasts that come through these routers/gateways determine the pool that dhcp assigns a lease from. So, if a client requests is seen by the sever comes from 192.168.1.1 it will get a lease out of that pool, and if it sees that the client requests cvomes from 192.168.2.1 it will get a lease from that pool. Is my understanding correct on this?

No, you are incorrect.
Basically, when you define a shared network, you are telling the server that all the subnets in it are "equivalent" - it can give any address to any client. Your broadcasts will all come from the same relay address(es) anyway regardless of the client.

In terms of allocation strategy, all the addresses in all the pools are put in a hashed list. When there are "never used before" addresses available then they will be given to new clients in an undocumented (and liable to change without warning) order which is currently top down (ie highest address first). Once there are no such addresses left, then addresses will be allocated in a least recently used order.
Basically, it is indeterminate which clients end up in which subnet.

If that isn't what you want, then you need to start using allow/deny rules to manage it. It may be as simple as defining hosts and using allow/deny known/unknown hosts, or you could use classes to allocate clients to pools.



More information about the dhcp-users mailing list