Pi not getting IP from pihole DHCP

Hello, I'm running pihole on my Raspberry Pi 4 in docker on host network. Since my ISP doesn't let me set DNS server directly, I'm using pihole's DHCP server.

When I enable DHCP on pihole and disable it on my server, it works well (I can see traffic flowing through, ads being blocked etc.). However, after some time, internet access seems to stop working. This occurs likely within 1h from switching router DHCP off - and 1h is the lease time of IP of my router.

After doing some googling and debugging, I reckon the problem is that the Raspberry Pi itself doesn't get new IP thus the other devices don't find any DHCP server (as the pi is inaccessible) and end up with the same problem.

Also when the problem occurs, I can immediately see this warning in pihole:

Warning in `dnsmasq` core:

DHCP packet received on wlan0 which has no address

I've tried to set static IP in /etc/dhcp/dhclient.conf like this:

interface "wlan0" {
	send dhcp-requested-address;

but with no change. Actually, it seems like the pi doesn't see the pihole DHCP server at all - when I disable DHCP on my router and run dhclient -r && dhclient -v, it doesn't get any response to DHCPDISCOVER.

From the debug log, I can see that the server did offer an IP (note that at the time of running the debug, I had both pihole's DHCP and my router's DHCP enabled so that I could reach it). Debug token here.

Thank you for any help, the project is amazing!

A DHCP server can't assign an IP address to itself, since it would already need an IP address to answer a DHCP request (kind of a hen-and-egg problem).

You need to either keep your router's DHCP active, shrink its DHCP range to accommodate just your Pi-hole host machine's IP addresses as well as configure a fixed IP address/DHCP lease reservartion for those, or to deactivate your router and manually set a static IP address on device.

For the latter, you should consult the documentation for the OS hosting your Pi-hole on how to achieve that with its preferred network management tool.

If that would indeed be ISC's DHCP client dhclient, then note that your current configuration just configures that to ask your router's DHCP server to get assigned a specific IP, which the router would be free to reject or comply with.

But since you are using an RPi to host your Pi-hole, it is most likely that you are running Raspberry Pi OS, which would employ either Roy Marple's dhcpcd for older releases or NetworkManager, so you'd had to look for instructions on how to configure those.

Thank you, this was it! I've tried both approaches, but had some issues with static IP with NetworkManager (I managed to get it, but devices didn't seem to work after disabling DHCP on the router). So I went the path of adjusting my router to distribute one, reserved IP for my Pi and having two DHCP servers on my network (but one is used just by the Pi). Ads are being blocked, and the Pi is getting its IP renewed as expected. Once again, thank you for your time!