Pi-hole DHCP server

From once I say that I use some google translator help

Expected Behaviour:

  • operating system: Raspberry Pi OS Lite (January 11th 2021 - kernel version: 5.4.83-v7+ updated to 5.10.10-v7+ to see if it will work (no it did not work))
  • clean installation, before pi-hole I only configured the Cups server
  • router Huawei B315s-22, 192.168.8.1 (DHCP disabled) (software up-to-date)
  • pi-hole interface eth0
  • pi-hole static ip addr: 192.168.8.199
  • local network: 192.168.8.0/24
  • pi-hole DHCP configuration: from 192.168.8.220 to 192.168.8.250, gateway: 192.168.8.1
  • no ufw on raspberrypi (I tried but it didn't work, so I turned it off)
    I expect pi-hole to be my DHCP server

Actual Behaviour:

Currently DHCP is not working, it is not distributing IP addresses.I thought it was the router's fault, but I ran another DHCP server (Windows) on the network and everything worked fine (but I had to add exceptions to the windows firewall).

Debug Token:

uskqnitnt2

Please help me, I really want this DHCP to work, if I have to change the router, I will do it, but I have to be sure that it will work then

Your debug log shows Pi-hole's DHCP server to be disabled.

It also shows discovering any DHCP server has failed:

*** [ DIAGNOSING ]: Discovering active DHCP servers (takes 10 seconds)
   Scanning all your interfaces for DHCP servers
   Timeout: 10 seconds
   
   DHCP packets received on interface eth0: 0
   DHCP packets received on interface lo: 0
   DHCP packets received on interface wlan0: 0

This would be conclusive with both Pi-hole's as well as your router's DHCP server being switched off.

Or, as a DHCP server is only receiving broadcasts from the same network segment, it may also indicate that your Pi-hole machine is not on the same network segment as your router.

Chances are your switch splits your network into different segments (or your router could do so by defining VLANs).

To forward DHCP broadcasts from a given segment to a given IP address, you'd need a DHCP relay on that segment.
See if your switch would allow you to configure a DHCP relay.

Ok now you can see in "pihole -d" that the DHCP server is up but still not allocating IP addresses. New Debug Token: lcuiebrzed
This time I connected only the client and pi-hole to the router via ethernet cable without additional switch. Still not working over both lan and wlan.
It's strange because when I type the command "pihole -d" and it scans DHCP, suddenly the wireshark logs appear


This only happens when I type "pihole -d"

I don't have many options to set up on the router. You can not set VLANs there for sure, only VoIP, firewall, MAC filter, port forwarding, special applications, DMZ, UPnP, NAT, DDNS

That should put them all on the same segment.

Clients won't request a new DHCP lease until their current one expires.
You may force a client o renew its lease e.g. by enabling or disabling its network adapater or by power-cycling it.

Make sure your router's DHCP server is switched off and only Pi-hole's is turned on before doing so.

If a client still doesn't request a lease through Pi-hole, it's likely that something is blocking DHCP, usually a firewall on your Pi-hole machine.
See Pi-hole's documentation on required ports and asscoiated firewall configuration examples.

No change, I added rules to ufw then "ufw enable" "ufw reload" and still the same in wireschark.
I tried to get the configuration for: smartphone, Ubuntu 16.04 and Windows, the same thing every time: "Getting IP address ..." for several seconds and that's it. There are still no dhcp entries in pihole.log
Maybe I should reinstall the Raspberry pi OS? Maybe I should install Desktop instead of Lite, or Ubuntu 20.04?

No, that won't change anything.

Pi-hole's DHCP server is fully operative, as confirmed by your debug log.
In addition, you also confirmed it's working when cutting your router out of the picture, i.e. if Pi-hole and a client are both connected to your switch.

So it seems your router is blocking your clients broadcasts for DHCP, as they are not reaching Pi-hole.

I suspect your router is closing DHCP ports once you disable its DHCP server. A short net research seems to support such a potential issue for Huawei B315s-22.

You could try if Pi-hole's DHCP server can coexist with your router's:
Don't switch DHCP off in your router, but rather limit your router's DHCP range to exactly one IP address, Pi-hole's .199.

If that fails as well, your router would disallow any DHCP traffic passing through it if its not directed at itself. There is nothing that could be done to change this, save from a firmware update for your router that fixes the issue.

You could still connect Pi-hole to your switch and serve DHCP clients connecting through your switch, but your router's wifi clients won't be able to negotiate a DHCP lease with Pi-hole, or any other DHCP server apart from your router.

1 Like

I was afraid of this. I tried to set DHCP only to address .199 but it failed.

Nevertheless, thank you very much for your help. Pi-hole is a great thing, I will soon borrow a newer router from a friend and run the DHCP test again. I will let you know if I was successful.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.