I would like that my Dhcp server renew lease using different IP

Simon Hobson dhcp1 at thehobsons.co.uk
Fri Jul 6 18:58:29 UTC 2007

Sébastien CRAMATTE wrote:

>I've got /22 subnet  (1024Ip's)  ...
>What happens is that my customers always keep the same IP like if paid
>for a static one ...
>More over some clients change their windows property and force the IP as
>static ...
>I would like that my Dhcp server renew lease using different IP  and
>prevent duplicates ... not every day  but at least every week or month ...
>Does it exits a mean ?

Not directly as it would be specifically in breach of the RFC.

You could however force some changes with some 
external scripting - I think several ideas have 
been mooted in the past, none of them simple or 
pretty !

1) Have several ranges and turn one of them off 
for a while in a rolling fashion. Eg

a = 50-99
b = 100-149
c = 150-199
d = 200-249

For a while you include all 4 ranges, then for a 
period at least as long as your max lease you 
drop range a - this will force all the clients 
with addresses in that range to get new 
addresses. You can go back to all four ranges for 
a while, then drop range b, and so on.

This does mean that some clients will have their 
addresses changed id session which will break any 
connections they have open.

2) Have a script 'mop up' any expired leases by 
creating very short 'dummy' leases. You could do 
this by running a script that periodically 
attempts to lease lots of addresses with 
different client-ids and a very short lease time. 
Thus any client that allowed it's lease to expire 
would have it's expired lease 'taken over' by one 
of these dummy requests - next time it asks for a 
lease there will be no record of it's previous 
lease and so it will get a different address.

This will result in devices getting new addresses 
only when it allows it's lease to expire (so 
won't break anything), but won't have any effect 
on devices that stay permanently connected (or 
disconnect for less than half the lease time).

3) Much more sophisticated would be to link your 
access equipment into a script so that when a 
client disconnects, you can trigger a process 
that will terminate it's lease and re-allocate 
the address (for a short term, ideally at least 
as long as the clients remaining lease time) to a 
dummy client (as in option 2) so that the client 
cannot have the same address back.

None of these are going to be particularly pretty !

More information about the dhcp-users mailing list