How to force ALL of the DHCP Clients to renew?
Asked Answered
P

5

52

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.

Pewee answered 7/3, 2015 at 16:32 Comment(3)
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".Pewee
Decided to clarify the question a bit.Pewee
For cases where you need to change the router address, you can either run 2 routers in parallel or add a second configuration to the same interface (or sub interface) on the router. Once clients have switched over, you can remove the old configuration.Americium
F
40

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"

Flotage answered 14/4, 2016 at 7:28 Comment(6)
Does ISC DHCP support DHCPv6 Reconfigure messages?Wove
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 [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.Divinize
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.Pewee
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"Pewee
jeez, you'd think with 37k views you would have gotten more upvotes than this.Pewee
Note, there is RFC6704, which updates RFC3203 specifically addresses the problems with RFC3118 authentication.Elamitic
G
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.

Gustav answered 7/3, 2015 at 16:36 Comment(3)
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.Pewee
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.Gustav
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.Gustav
W
6

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.

Wares answered 17/10, 2018 at 0:12 Comment(4)
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 (serverfault.com/questions/739022/…) ; starting the server again; turn off the AirPlane mode.Priscella
Question: wouldn't it be faster/easier to just reboot the router?Kosak
@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 timeWares
Rebooting may be worth a try, it just worked for me on an Asus RT-AC86U.Coyotillo
A
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.

Aldehyde answered 22/9, 2017 at 22:55 Comment(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. CentOS7Salmonberry
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 dhcpdAltair
D
-1
psexec \\\computername ipconfig /renew
Danzig answered 24/7, 2018 at 9:1 Comment(2)
Could you explain why and how this answers the question?Axes
This only works for Windows machines that you're able to remote access.Venal

© 2022 - 2024 — McMap. All rights reserved.