[GUIDE] Fix for slow DHCP address acquisition in Windows 10 (possibly others)

Hey everyone, this has given me headaches for a week or so and since I've found the issue and fixed it I thought to write a short guide for others hat run into the same issue.

TL;DR: If you find your devices are slow to configure their IP addresses via DHCP (1 minute or more) make sure that your OpenWRT DHCP server has "authoritative" option enabled

So my main PC (running Windows 10) was having issues getting its IPv4 address from OpenWRT's DHCP server, while other devices (running either Windows 10, Ubuntu, Android or proprietary OSs) were just fine. It would take over 1 minute (about 60 seconds from loading the OS) of "limited connectivity" until it would configure itself with the correct settings. It was hard to debug the reason as I could not do any packet capture straight from the boot up, until I ran tcpdump on OpenWRT itself and did some comparison with other devices that configure correctly.

The issue, apparently, was a 3-stage planetary alignment that worked against me:

  1. I had completed a migration from one OpenWRT device to another - while they were both on the network the DHCP server on the new device was stopped (I changed the new device's IP address to the old device IP address after it was removed from the network)
  2. My main PC was on during all of this and used its DHCP lease from the "old" OpenWRT, it never got a lease from the new device
  3. Windows 10 apparently requests its "preferred" (read "old") IP address from the network (DHCP REQUEST packet) every 5 seconds waiting for an ACK (or NACK, probably), and then just installs the old lease if there are no other devices running at that IP address, without bothering to scrap it and do a DHCP DISCOVER

So because of (1), my OpenWRT did not have the "authoritative" option enabled. Because of (2), OpenWRT never offered a lease to my PC, and because of (3), my PC never asked for one.
After enabling "authoritative", OpenWRT promptly gave my PC an ACK and I got everything working as before.

5 Likes