Pihole as DHCP on bookworm

what is the correct way to use pihole as dhcp server on:
$uname -r
6.1.0-rpi8-rpi-v8

$uname -a
Linux raspberrypi 6.1.0-rpi8-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.73-1+rpt1 (2024-01-25) aarch64 GNU/Linux

$lsb_release -a

No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm

i've found this but does not help me at all
if i try to ping o got

ping: cisco.com: Temporary failure in name resolution

and dig dnssec.works @127.0.0.1 -p 5335 returns

; <<>> DiG 9.18.24-1-Debian <<>> dnssec.works @127.0.0.1 -p 5335
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 36748
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;dnssec.works.			IN	A

;; Query time: 4 msec
;; SERVER: 127.0.0.1#5335(127.0.0.1) (UDP)
;; WHEN: Wed Feb 28 17:27:29 CST 2024
;; MSG SIZE  rcvd: 41

not sure what im doing wrong here

  1. Determine the IP layout. For example on a typical layout your router might be on .1, you can put Pi-hole on .2, and the DHCP range will be from .10 to .254 (giving you a few extra spaces below .10 for other static IPs later if desired)

  1. Install latest Pi OS
  2. Update it with sudo apt update and sudo apt upgrade
  3. Configure a static IP, eg .2 in the above example. Bookworm uses Network Manager so you can do this easily with sudo nmtui. In nmtui the router's IP will be the gateway, and for the OS DNS servers go with something external such as your ISP's DNS or Cloudflare's 1.1.1.1
  4. Reboot and confirm the static IP is in place and that you have external connectivity

  1. Install Pi-hole and select the correct interface when prompted
  2. Enable Pi-hole as a DHCP server. Use the range determined in step 1
  3. Ensure that the router's DHCP server is turned off
  4. Bounce all clients off and on the network so they pick up their new settings from Pi-hole

You can install Unbound if you wish, that is separate to the DHCP feature.

1 Like

I've apply those configs, adding the unbound as per de doc, opened ports as per de doc set the configs on the router
but still not getting dhcp working :s

When you say it's not working, what exactly are you seeing happen?

Can you create a debug log please. The command below will create and auto-upload a debug log to the server. Post the URL token it gives you in here.

pihole -d -c -a

nevermind, now it is working.
for some reason looks like i didnt disable the dhcpv6 on the router, after disabling it, now it is working as expected.
pihole as upstream dns and dhcp server.

thanks for the help!

1 Like

Well it was working, now im getting this error
'DHCP packet received on eth0 which has no address'
after some time the ip change and start seeing that error while running
$pihole -t
Let me post the debug token
https://tricorder.pi-hole.net/n9j3u9rj/

I think this may be to do with your DHCP range. Your Pi-hole has IP 192.168.0.3 which should be configured as a static IP. But your Pi-hole is also serving that address from its DHCP pool:

DHCP_ACTIVE=true
DHCP_START=192.168.0.3
DHCP_END=192.168.0.250

In Settings > DHCP change the From address to be 192.168.0.4 and Save the changes with the button at the bottom. That way Pi-hole's own address and the pool addresses won't come into conflict.

1 Like

weird, looks like the one is loosing the ip is the pihole, i've made the changes you suggested
debug log:
https://tricorder.pi-hole.net/iWhwiAad/

previous dhcp config on router was
image

not sure if that may introduce the trouble? :thinking:

That last debug log shows everything working, Pi-hole continues to be at 192.168.0.3. There are some adlists which failed which typically indicates temporary loss of connectivity, for example broadband happens to be down for a few moments right when Pi-hole tries to update. Clear those error messages in Pi-hole and try another Gravity update, see what happens.

How did you give Pi-hole its 192.168.0.3 address? In the earlier post I suggested using nmtui to configure it manually as a static IP, and ensure the DHCP pool range doesn't overlap.

In that screenshot you've posted it looks like it was previously done by having the router's own DHCP allocate a single address, and presumably this would be reserved for Pi-hole, and Pi-hole would be configured to use DHCP. And that's why that screenshot looks like that?

If you've configured Pi-hole to have a static IP this time, the router's DHCP is no longer needed and should remain switched off. Pi-hole will always have the address 192.168.0.3 because it's been manually configured, and all the other clients will get an address from Pi-hole's DHCP pool.

1 Like

the initial aproach was to get the router with dhcp from .2 to .3, where .2 was my laptop and .3 the pihole, so incase internet connection was lost or dhcp still not working, im still able to access the router settings without hard-reset the router. i was algo setting those ip by static ip using device's mac. now that static setting is no longer present, also router's dhcp is no longer active.

i set the 192.168.0.3 with nmtui as:

Ace, thanks for confirming. That looks perfect. The Pi-hole will keep using that address for itself. I suspect the adlist issue was a coincidence, as everything in your debug log looks great now.

Are you able to ping one of the failed adlist domains from a terminal on the Pi-hole?

ping zerodot1.gitlab.io

I just noticed the 8th one down has a missing h so will always fail

ttps://raw.githubusercontent.com/......
1 Like

i've tried to flush the network table and restart the dns, also the pihole itself but seems not helping me with that issue which is pihole lose the ip after sometime :confused:
i mean, the pihole boot with ip 192.168.0.3 after 2-3 minutes if i run
$ip add
eth0 has no ip

maybe do i need to open a new topic for this issue?

since dhcp allocations seems to be working

1 Like

Okay, yes please, if something new is going on now, thankyou.

1 Like

thanks for the help, really appreciated it!

1 Like

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