Force DHCP server to assign new IP to client

Simon Hobson dhcp1 at thehobsons.co.uk
Tue Oct 14 14:24:43 UTC 2014


Jeffrey Zheng <jeffreyzheng at live.com> wrote:

> I am working on a project in which I would like to force DHCP server to assign a new IP address to client whenever the client sends an IP request, instead of keeping the current IP address. Is it possible? If yes, can someone please tell me how to do it?

As Chuck so eloquently put it, it's a recipe for "unhappy" clients. At the very least it will terminate all active connections every time the client renews it's lease, and with some clients it may cause bigger problems as there have been reports on this list from time to time of clients not handling changed leases very well.

As pointed out, it's against the letter and spirit of the RFCs, which the ISC coders worked hard to follow. Thus the ISC code goes to great lengths to *NOT* change the client's address.
Apart from techniques like periodically changing the config to make some addresses unavailable, one I can think of might go like :

Write a script that monitors the logs, and every time an address is ACKed make note of it.
The script then needs to update the DHCP config, explicitly making the address unavailable - perhaps by adding it to a class and denying that class access ot the address pool.
The next time the client attempts to renew, it's request will be Nacked and it'll start over with a Discover to get a new address.
The script needs to clean up, removing the blocked IPs from the list. A simple timeout would suffice but you could lose a lot fo addresses, but you could monitor the logs for the DHCP-NAck and set the address to be removed a short time later.

It's a lot of work to go to just to break things and make life difficult for your clients.



More information about the dhcp-users mailing list