Sequential DHCP addresses

Started by john9527, February 15, 2018, 12:43:16 AM

Previous topic - Next topic
All the current documentation says that the DHCP server assigns addresses based on a hash of the MAC address, yet OPNsense assigns them sequentially.   Is there a setting to force the hashed address assignments?

Where does it say that?

IPv6 is sort of does it that way, but v4?
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

February 15, 2018, 10:31:50 AM #2 Last Edit: February 15, 2018, 10:44:46 AM by john9527
dhcpd(8) - Linux man page
https://linux.die.net/man/8/dhcpd

The DHCP server generates the list of available IP addresses from a hash table. This means that the addresses are not sorted in any particular order, and so it is not possible to predict the order in which the DHCP server will allocate IP addresses. Users of previous versions of the ISC DHCP server may have become accustomed to the DHCP server allocating IP addresses in ascending order, but this is no longer possible, and there is no way to configure this behavior with version 3 of the ISC DHCP server.

I've become accustomed to this behavior since this is the way most consumer routers work using dnsmasq as the dhcp server.  With dnsmasq the hash is based on the mac, so you end up with a virtually-static ip.

Maybe I'm mistaken as to the server used in opnsense.

I think your crossing your man docs. The reference you make in paragraph one comes from ISC dhcp server, not dhcpd as used in opnsense.  :)

OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member


February 15, 2018, 06:36:14 PM #5 Last Edit: February 15, 2018, 06:50:24 PM by marjohn56
That also refers to ISC dhcp server, not dhcpd.

Hold horses, I may be thinking of something else... brain is tired, you appear to be correct. I'll go check it out.

.........

You are correct, I AM thinking of something else.

I'll go re-read the manual and do some tests.

OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

February 15, 2018, 06:51:55 PM #6 Last Edit: February 15, 2018, 07:02:08 PM by marjohn56
My reading of that doc does not indicate that the addresses will be based upon the mac address of the client, just  an internally generated hash table of addresses, that may or may not get given out in sequence.

If the client sends a release when it goes offline, then that address will be returned to the pool for re-use. If I want something to always get the same address I create a static entry for it, otherwise there would be little point in having that option.
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

Quote from: marjohn56 on February 15, 2018, 06:51:55 PM
My reading of that doc does not indicate that the addresses will be based upon the mac address of the client, just  an internally generated hash table of addresses, that may or may not get given out in sequence.
Agreed it doesn't say mac hashing, I just used the design of dnsmasq as an example.   But I would have expected some randomness...it does appear to still be sequential.

QuoteIf the client sends a release when it goes offline, then that address will be returned to the pool for re-use. If I want something to always get the same address I create a static entry for it, otherwise there would be little point in having that option.
Actually, in re-reading the FreeBSD man page, it would seem there is a 'sticky' nature to the assigned IPs, even if the lease expires and the client is disconnected (most clients don't actually send a release, I'm only aware of an option for windows not set by default).   I'll have to test this out a bit more.