DHCP stopped working

Expected Behaviour:

With DHCP disabled on my router and enabled on my pihole. Then devices on my network using DHCP should request an IP address and that IP address would be provided by the DHCP server on my pihole.

Actual Behaviour:

My Pihole does not appear to even be seeing DHCP requests. During the period for my debug log there were many devices on my network trying to get a DHCP lease.

The problem occurred whilst I was moving a few leases from dynamic to static leases.

Debug Token:

https://tricorder.pi-hole.net/7bObNSEI/

[i] Default IPv4 gateway: 192.168.1.254
   * Pinging 192.168.1.254...
[✗] Gateway did not respond. (https://discourse.pi-hole.net/t/why-is-a-default-gateway-important-for-pi-hole/3546)

Are you able to ping the router? And do you have any kind of firewall or something that may be blocking DHCP traffic?

You do have the static IP of the Pi-hole server inside the DHCP address pool range.

    IPV4_ADDRESS=192.168.1.116/24

    DHCP_ACTIVE=true
    DHCP_START=192.168.1.64
    DHCP_END=192.168.1.253
    DHCP_ROUTER=192.168.1.254

And unrelated, you don't need both 127.0.0.1 and :: as upstreams, both point to the same exact place and 127.0.0.1 is fine by itself and no IPv6.

    PIHOLE_DNS_1=127.0.0.1#5335
    PIHOLE_DNS_2=::1#5335

Hi Dan,

There's no firewall that might be blocking the traffic. I've reconfigured the pihole to use 192.168.1.3 outside of the DHCP range and the router is pingable.

pi@pihole:~ $ ifconfig -a
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2656  bytes 429047 (418.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2656  bytes 429047 (418.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.3  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::2839:4119:c5e1:4ae0  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:c8:bf:90  txqueuelen 1000  (Ethernet)
        RX packets 1625  bytes 403785 (394.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 358  bytes 42881 (41.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

pi@pihole:~ $ ping 192.168.1.254
PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.
64 bytes from 192.168.1.254: icmp_seq=1 ttl=64 time=2.32 ms
64 bytes from 192.168.1.254: icmp_seq=2 ttl=64 time=17.2 ms

However, with DHCP marked as 'enabled' in the UI. There still doesn't appear to be anything listening on port 67.

root@pihole:/home/pi# nmap -sU -p67 --script dhcp-discover 192.168.1.3
Starting Nmap 7.70 ( https://nmap.org ) at 2021-12-22 09:06 GMT
Nmap scan report for 192.168.1.3
Host is up (0.00044s latency).

PORT   STATE  SERVICE
67/udp closed dhcps

Nmap done: 1 IP address (1 host up) scanned in 18.10 seconds

I think I found the problem is in /etc/pihole/setupVars.conf!

WEBPASSWORD=
ADMIN_EMAIL=
WEBUIBOXEDLAYOUT=boxed
WEBTHEME=default-dark
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@DHCP_ACTIVE=true
PIHOLE_INTERFACE=wlan0
IPV4_ADDRESS=192.168.1.116/24
IPV6_ADDRESS=fd5b:51c8:97bf:1:4cfb:2337:59e3:f11
QUERY_LOGGING=true
INSTALL_WEB_SERVER=true
INSTALL_WEB_INTERFACE=true
LIGHTTPD_ENABLED=true
CACHE_SIZE=10000
DHCP_START=192.168.1.64
DHCP_END=192.168.1.253
DHCP_ROUTER=192.168.1.254
DHCP_LEASETIME=24
PIHOLE_DOMAIN=lan
DHCP_IPv6=true
DHCP_rapid_commit=false
DNSMASQ_LISTENING=single
PIHOLE_DNS_1=127.0.0.1#5335
DNS_FQDN_REQUIRED=true
DNS_BOGUS_PRIV=true
DNSSEC=true
REV_SERVER=false
BLOCKING_ENABLED=false
DHCP_ACTIVE=false

I have never edited this file manually before, so not sure how all of the @ symbols got there. But right before the problem started I did experience some weird behaviour in the UI.

The fact you pointed out that the default gateway wasn't pingable in the debug log was the thread I followed to find the problem. It was certainly pingable from the command line. It wasn't pingable from the debug log because PIHOLE_INTERFACE was not set. It wasn't set because of the rogue characters in the config file.

To prove this I made a minor change to line 684 of /opt/pihole/piholeDebug.sh changing:

 684         log_write "   * Pinging ${gateway} **through ${PIHOLE_INTERFACE}**..."
 

When I ran debug again the output was as follows, showing no value for ${PIHOLE_INTERFACE}


*** [ DIAGNOSING ]: Networking
[✗] No IPv4 address(es) found on the  interface.

[✗] No IPv6 address(es) found on the  interface.

[i] Default IPv4 gateway: 192.168.1.254
   * Pinging 192.168.1.254 through ...
[✗] Gateway did not respond. (https://discourse.pi-hole.net/t/why-is-a-default-gateway-important-for-pi-hole/3546)

So right now, I've resolved that much of the issue. The port is now open but still not serving any DHCP addresses.

Finally resolved!

I found that in /etc/dnsmasq.d/01-pihole.conf the interface line stated

interface=eth0

My pihole is a Raspberry pi Zero W, so there is no eth0 only wlan0.

The headers in the file tell you to make the changes in /etc/pihole/setupVars.conf. But that file already had

PIHOLE_INTERFACE=wlan0

So I ignored the header and went ahead an edited 01-pihole.conf directly.

I think ultimately it comes down to a corruption of /etc/pihole/setupVars.conf that happened whilst I was using the UI to move some DHCP leases from dynamic to static.

1 Like

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