Discussion:
[Dnsmasq-discuss] Sequential IP doesn't look for unused IPs
Alec Robertson
2016-12-24 01:04:55 UTC
Permalink
When using sequential IP, the IP allocation should start from the lowest
available IP address.

However, if the lease time is quite short for the clients, the clients can
renew their IP addresses and be given IP addresses that don’t use the
entire range available, meaning that you could have a range that starts at
say 1 but this IP address is never used again because the sequential IP
system does not look for IPs that aren’t “filled”. Instead, it simply goes
for the lowest available IP that is available after the last one that was
allocated.

I am sorry for my very poor description but I tried the best I could to
explain this problem.
Albert ARIBAUD
2016-12-24 08:32:54 UTC
Permalink
Hi Alec,

Le Fri, 23 Dec 2016 20:04:55 -0500
Post by Alec Robertson
When using sequential IP, the IP allocation should start from the
lowest available IP address.
However, if the lease time is quite short for the clients, the
clients can renew their IP addresses and be given IP addresses that
don’t use the entire range available, meaning that you could have a
range that starts at say 1 but this IP address is never used again
because the sequential IP system does not look for IPs that aren’t
“filled”. Instead, it simply goes for the lowest available IP that is
available after the last one that was allocated.
I am sorry for my very poor description but I tried the best I could
to explain this problem.
There might be a misunderstanding about "sequential" here.

You seem to think that dhcp-sequential-ip will cause dnsmasq to
react to every request by searching upward from the range start for the
first available IP.

I suspect what it does for every request is search for the first
available IP from the last point it had reached so far; beginning at
the range start is just what happens for the very first request
received.

IOW, you think it always allocates the lowest currently free IP whereas
I suspect it will actually allocate the lowest free IP above the last
one allocated.

My suspicion comes from the fact that the sequential behavior is
probably named after its visible effect, i.e. going over the full range
in sequence even if older IP were freed in between.

Amicalement,
--
Albert.
w***@gmail.com
2016-12-24 13:02:30 UTC
Permalink
Post by Alec Robertson
When using sequential IP, the IP allocation should start from the lowest
available IP address.
this depends on the implementation... some start at the bottom (lowest) and
others start at the top (highest)... where they start does not really matter...
the *nix systems i've worked with all started at the top when allocating IPs to
non-psuedo-static systems... IIRC, winwhatever is the only one i've worked with
that started at the bottom...
--
NOTE: No off-list assistance is given without prior approval.
*Please keep mailing list traffic on the list* unless
private contact is specifically requested and granted.
Alec Robertson
2016-12-24 14:55:09 UTC
Permalink
Thank you for your replies.

What I mean (as I said I didn’t explain it very well), is that the
sequential IP feature results in lots of empty IP addresses, so effectively
you end up with a much smaller range of possible IP addresses.

I was requesting the ability for dnsmasq to look through the entire
possible range of IP addresses and if it finds one that is not assigned, it
assigns that first before then working its way up from the last assigned
address.
Albert ARIBAUD
2016-12-24 17:33:23 UTC
Permalink
Hi again Alec,

Le Sat, 24 Dec 2016 06:55:09 -0800
Post by Alec Robertson
Thank you for your replies.
What I mean (as I said I didn’t explain it very well), is that the
sequential IP feature results in lots of empty IP addresses, so
effectively you end up with a much smaller range of possible IP
addresses.
I was requesting the ability for dnsmasq to look through the entire
possible range of IP addresses and if it finds one that is not
assigned, it assigns that first before then working its way up from
the last assigned address.
Sorry, but I understand this less than I understood your first
message :) -- there is no such concept of an "empty IP adresses" and the
range of IP addresses available via DHCP does not depend on the
allocation process (though the range of adresses actually used will
depend on the method... and on the bumber and timings of the client
requests, as the manpage hints).

To clarify your problem and your need, the best would be to give a step
by step example up to the point where the problematic situation occurs,
and compare it with the expected situation, e.g.

"1) The server is started with a range of available IPs from
192.168.0.1 to 192.168.0.30.

2) client A requests an IP and gets 192.168.0.1.

3) ...

...

N) 'X' then happens."

I would prefer to see 'Y' happen, rather than 'X', at step N."

This mode of problem description will be far less susceptible to
ambiguity.

Amicalement,
--
Albert.
Alec Robertson
2016-12-24 21:15:23 UTC
Permalink
My apologies for the unclear explanation.

For background I am using OpenWRT/LEDE r2544-a032940, on a TP-LINK Archer
C7.

For a test, if you set the leasetime to be very short, say 2 minutes and
connect multiple devices, they will at first be given IPs in sequential
order starting from the lowest allowed IP address, say 192.168.0.20. So,
the next device will be 192.168.0.21, the next 192.168.0.22 and so on


If the device at 192.168.0.20 gets disconnected for over 2 minutes, its
lease expires. If the device reconnects to the network, it will be given
the IP address say 192.168.0.24, despite 192.168.0.20 being available. The
next new device added to the network will be given 192.168.0.25.

So, 192.168.0.20 will never be assigned again, unless the network is
entirely reset, i.e. dnsmasq is completely reset back to defaults.

Does that make a bit more sense?
Alec Robertson
2016-12-24 23:13:46 UTC
Permalink
I understand what you’re saying but I was suggesting this should be a
feature enhancement. All the other routers I have used work the way I have
described, be it NETGEAR, Asus, Huawei, etc.
Albert ARIBAUD
2016-12-25 11:03:31 UTC
Permalink
(TL;DR: skip to last paragraph of my reply)

Hi Alec,

Le Sat, 24 Dec 2016 18:13:46 -0500
I understand what you’re saying but I was suggesting this should be a
feature enhancement. All the other routers I have used work the way I
have described, be it NETGEAR, Asus, Huawei, etc.
Oh, ok. I was misled by the negative form in your message subject, which
I read as pointing a perceived misbehavior as opposed to suggesting a
new one.

So, have I got it right that your point can be summed up as follows:

"1. Right now, dnsmasq's DHCP server feature allocates IP based on
either one of the two following (summarized) strategies:

a) Select the IP based on a hash of the MAC, or

b) Select the oldest free IP available.

2. It is suggested to add a strategy which would be summarized as:

c) Select the lowest free IP."

If so, then I'm sorry about the misunderstanding: while I could have
helped on a perceived or real misbehavior diagnosis, I am not involved
in any part of developing dnsmasq so my feedback on a feature request
would be worthless.

However, I do have a question about this feature request; please bear
with me for a minute there.

I do understand that strategy c above is easily implemented (it's
basically a context-insensitive loop) as opposed to the other two, so
it makes sense to implement that when developing a DHCP server from
scratch, I do not see what benefit it brings to a DHCP server which
already has two allocation options in place. IOW, what does option c
bring that options a or b don't?

Obviously, option c reduces the number of different IPs allocated over
time with respect to option b, as option b goes through the whole
range while option does not. But then, option a also keeps the number
of allocated IPs to a minimum.

There is a difference, though, between options c and a: option c keeps
that minimum set of IPs tight, whereas option a (possibly) spreads the
set over the whole range.

So, the real distinguishing feature of option c is "keep the allocated
IPs as grouped near the range base as possible".

But that's a /characteristic/, not a /benefit/ -- at least, I cannot
see the benefit yet.

So I suspect there is something in the currently available options a
and b which causes an issue in your use of dnsmasq to the point of
making you want to see option c implemented.

Now, this something may actually be solved by implementing option c, or
it may be a symptom of another problem for which there is a better
solution than option c.

As I don't remember having seen a similar request (I might have missed
it, though), I suspect that it is not widely seen as a solution, which
makes me lean toward the "there is a better solution" side, but that's
only a hunch; hence my questioning, to either get rid of a false hunch,
or see it confirm and get to a better solution to your problem.

And for that, we need the problem laid out (as opposed to laying out the
perceived solution)

So the question becomes in fact why is a 'tight low range' IP
allocation strategy needed exactly, or more precisely, what is the
problem that you have which dnsmasq's existing IP allocation strategies
cause, or at least do not solve?

Amicalement,
--
Albert.
Alec Robertson
2016-12-26 20:54:34 UTC
Permalink
Thank you for your reply. It was just really to make it like every other
router I’ve used. It’s not a “problem” as such.

—
Alec Robertson

On 25 December 2016 at 11:03:35, Albert ARIBAUD (***@free.fr)
wrote:

(TL;DR: skip to last paragraph of my reply)

Hi Alec,

Le Sat, 24 Dec 2016 18:13:46 -0500
Post by Alec Robertson
I understand what you’re saying but I was suggesting this should be a
feature enhancement. All the other routers I have used work the way I
have described, be it NETGEAR, Asus, Huawei, etc.
Oh, ok. I was misled by the negative form in your message subject, which
I read as pointing a perceived misbehavior as opposed to suggesting a
new one.

So, have I got it right that your point can be summed up as follows:

"1. Right now, dnsmasq's DHCP server feature allocates IP based on
either one of the two following (summarized) strategies:

a) Select the IP based on a hash of the MAC, or

b) Select the oldest free IP available.

2. It is suggested to add a strategy which would be summarized as:

c) Select the lowest free IP."

If so, then I'm sorry about the misunderstanding: while I could have
helped on a perceived or real misbehavior diagnosis, I am not involved
in any part of developing dnsmasq so my feedback on a feature request
would be worthless.

However, I do have a question about this feature request; please bear
with me for a minute there.

I do understand that strategy c above is easily implemented (it's
basically a context-insensitive loop) as opposed to the other two, so
it makes sense to implement that when developing a DHCP server from
scratch, I do not see what benefit it brings to a DHCP server which
already has two allocation options in place. IOW, what does option c
bring that options a or b don't?

Obviously, option c reduces the number of different IPs allocated over
time with respect to option b, as option b goes through the whole
range while option does not. But then, option a also keeps the number
of allocated IPs to a minimum.

There is a difference, though, between options c and a: option c keeps
that minimum set of IPs tight, whereas option a (possibly) spreads the
set over the whole range.

So, the real distinguishing feature of option c is "keep the allocated
IPs as grouped near the range base as possible".

But that's a /characteristic/, not a /benefit/ -- at least, I cannot
see the benefit yet.

So I suspect there is something in the currently available options a
and b which causes an issue in your use of dnsmasq to the point of
making you want to see option c implemented.

Now, this something may actually be solved by implementing option c, or
it may be a symptom of another problem for which there is a better
solution than option c.

As I don't remember having seen a similar request (I might have missed
it, though), I suspect that it is not widely seen as a solution, which
makes me lean toward the "there is a better solution" side, but that's
only a hunch; hence my questioning, to either get rid of a false hunch,
or see it confirm and get to a better solution to your problem.

And for that, we need the problem laid out (as opposed to laying out the
perceived solution)

So the question becomes in fact why is a 'tight low range' IP
allocation strategy needed exactly, or more precisely, what is the
problem that you have which dnsmasq's existing IP allocation strategies
cause, or at least do not solve?

Amicalement,
--
Albert.
Vladislav Grishenko
2016-12-26 22:25:08 UTC
Permalink
Hi Alec,



A bit disagree on that, at up-to-time Asus routers use hashed mac allocations, not sequential.

Older ones – did sequential allocation with reuse of expired IP from the very start (original udhcpd behavior), and in my practice, it rose issues when the same ip was allocated to different interfaces of one particular host, first time – as a first lease, second – after a hibernate/sleep. Same code was merged into ***@busybox and was fixed into sdbm hash several years ago.

In my opinion, sequential reuse of ip pool does more harm than helps to keep the “things” in order.

Best Regards, Vladislav Grishenko



From: Dnsmasq-discuss [mailto:dnsmasq-discuss-***@lists.thekelleys.org.uk] On Behalf Of Alec Robertson
Sent: Sunday, December 25, 2016 4:14 AM
To: dnsmasq-***@lists.thekelleys.org.uk
Subject: Re: [Dnsmasq-discuss] Sequential IP doesn't look for unused IPs



I understand what you’re saying but I was suggesting this should be a feature enhancement. All the other routers I have used work the way I have described, be it NETGEAR, Asus, Huawei, etc.
Weedy
2016-12-27 14:31:41 UTC
Permalink
Post by Alec Robertson
My apologies for the unclear explanation.
For background I am using OpenWRT/LEDE r2544-a032940, on a TP-LINK Archer
C7.
Have you disabled option leasefile '/tmp/dhcp.leases'? Any time a
client comes back it really should get the same IP it had back.

Continue reading on narkive:
Search results for '[Dnsmasq-discuss] Sequential IP doesn't look for unused IPs' (Questions and Answers)
9
replies
What is Disk fragmentation and de-fragmentation? Any benefits?
started 2009-02-07 00:03:57 UTC
desktops
Loading...