45

Is there any network broadcast call or something that can force all the connected DHCP clients to renew their addresses immediately?

And if not, why not? Surely this functionality has been desired by DHCP administrators from the date it was born. It makes changing a router address on a big network very hard without pervasive client automation.

Mike Wise
  • 22,131
  • 8
  • 81
  • 104
  • 2
    Not a duplicate for a number of reasons. The main one being that I am asking to force a renewal of ALL the clients in a network, and that question is only asking about one. And the answers are different too. The answer to my question is a flat out NO, whereby the answer to the other one is "sometimes". – Mike Wise Apr 12 '16 at 22:27
  • Decided to clarify the question a bit. – Mike Wise Nov 25 '16 at 11:06

5 Answers5

39

It is not possible without letting the network down and up at the client network interface.

Theoretically, the DHCP server can send a FORCERENEW message to all connected clients. FORCERENEW is described at RFC3203. (See also https://serverfault.com/a/569869/107832)

Unfortunately, the famous ISC DHCP Server does not support it:

RFC 3315 states in section 19.4.1 reconfigure messages. This is, however, for IPv6 only. A message states that DOCSIS 3.0 "requires Reconfigure support (for DHCPv6) as specified in RFC3315"

Community
  • 1
  • 1
koppor
  • 19,079
  • 15
  • 119
  • 161
  • Does ISC DHCP support DHCPv6 Reconfigure messages? – Todd Freed Sep 12 '16 at 18:01
  • 3
    Examination of client source code in dhc6.c of ISC DHCP 4.3.1, the answer is a qualified YES, @ToddFreed. In section 14 of [https://tools.ietf.org/html/rfc3315], it implements an integer range of 1..40 instead of a float range of -0.1..0.1. But in all sense and purposes, the code looks like it supports reconfigure messages. – John Greene Sep 27 '16 at 01:41
  • 2
    That would be worth expanding upon, with some source code extracts here, in a new answer. I would upvote it, and this question gets a lot of views still. – Mike Wise Oct 01 '16 at 09:09
  • 2
    This is a "famous question" now, with a steady beat of new visitors (about 18 a day I think). I think that alone belies the statement "no real interest by users" – Mike Wise Feb 01 '17 at 02:34
  • 1
    jeez, you'd think with 37k views you would have gotten more upvotes than this. – Mike Wise Sep 20 '18 at 20:20
12

It's not directly possible - DHCP issues an IP address with a lease. That lease tells the client how long it's 'valid' for, after which it must renew. Usually - it'll renew the same IP, but this is the point at which the DCHP negotiation occurs.

Forcing every machine on a network segment to renew is a really good way of creating a denial of service attack.

But instead you can turn down the lease time to a few minutes whilst you're transitioning to the new network topology. Practically speaking, this will mean a small outage, but you'd get that anyway with re-acquisition of multiple IPs.

Sobrique
  • 52,974
  • 7
  • 60
  • 101
  • 2
    So you need to plan ahead - timewise at least as long as your lease settings. That is a royal pain. Seems like there should be a better way. – Mike Wise Mar 07 '15 at 17:59
  • 2
    Manually run the release-renew on each machine. In a small network it's easy, and in a big one, you should be doing it as a planned change anyway, so it doesn't matter. – Sobrique Mar 07 '15 at 20:04
  • Client automation isn't as hard as you think too - on any network of any size you should either have them on a domain (if windows) and thus can `psexec` or have SSH public-private key pairs configured for Unix. – Sobrique Mar 07 '15 at 20:11
5

Note: this only partially address the OP's question.

To force only all Wi-Fi DHCP clients to renew their DHCP lease, this is what you can do. Assuming Wi-Fi DHCP clients connect to your router's SSID and your router management interface supports these functionality.

  • disable DHCP server
  • turn off both 2.4G and 5G Wifi
  • re-enable Wifi network
  • re-enable DHCP server

I used WebUI via a client connected to the router via ethernet.

Tzunghsing David Wong
  • 1,271
  • 14
  • 10
  • 1
    Why this answer helped me: an Android 6.0 device (Motorola), was insisting with a buggy DHCP lease, which was already eliminated on isc-dhcp-server. And a different approach, would be putting the mobile device in Air Plane mode; shutting down isc-dhcp-server; cleaning DHCP leases (https://serverfault.com/questions/739022/how-do-i-manually-release-a-dhcp-lease-on-the-dhcp-server-itself#739027) ; starting the server again; turn off the AirPlane mode. – ivanleoncz Jan 28 '19 at 19:47
  • Question: wouldn't it be faster/easier to just reboot the router? – J. Scott Elblein Dec 07 '19 at 07:48
  • 4
    @J.ScottElblein Rebooting router may not force a DHCP client to renew its DHCP lease as the client may hold on to its DHCP-assigned IP until the lease's expiration time – Tzunghsing David Wong Dec 08 '19 at 19:36
  • Rebooting may be worth a try, it just worked for me on an Asus RT-AC86U. – CAD bloke Aug 02 '22 at 02:17
1

I managed to remove all the leases by shutting down the dhcpd service, deleting the /var/lib/dhcpd/dhcpd.leases file, and restarting the daemon. Then you have to get each device to obtain an IP address from the DHCP server. For some devices a simple power cycle will work.

Ben
  • 19
  • 1
  • 2
    This ended up breaking my DHCP server. Won't hand out anymore leases. :( Error was no such file or directory, it didn't remake the file on its own. When I remade it, it wouldn't write to it, permission issue I guess. CentOS7 – Darius Mar 21 '18 at 12:01
  • The safer way: `systemctl stop dhcpd ; cp /var/lib/dhcpd/dhcpd.leases /var/lib/dhcpd/dhcpd.leases.backup ; > /var/lib/dhcpd/dhcpd.leases ; systemctl start dhcpd` – Onnonymous Sep 10 '20 at 10:39
-1
psexec \\\computername ipconfig /renew
Bugs
  • 4,491
  • 9
  • 32
  • 41