PiHole DHCP not working for ESP8266

I guess there isn't any chance I could take a look at the source code of the device to try to find why it behaves so strangely? Maybe it's also a question you should ask the manufacturer now that we found out what the issue is and how to reliably reproduce it.

Sorry for the delay, I had an extended Easter break but as that's off-topic Ill get right to it ...

This made no difference, and the ESP was unable to connect with 192.168.4.207 added as a second DNS address.

Yes, it is working correctly:

Scanning all your interfaces for DHCP servers
Timeout: 10 seconds

* Received 300 bytes from eth0:192.168.4.1
  Offered IP address: 192.168.4.180
  Server IP address: 192.168.4.1
  Relay-agent IP address: N/A
  BOOTP server: (empty)
  BOOTP file: (empty)
  DHCP options:
   Message type: DHCPOFFER (2)
   server-identifier: 192.168.4.1
   lease-time: 172800 ( 2d )
   renewal-time: 86400 ( 1d )
   rebinding-time: 151200 ( 1d 18h )
   netmask: 255.255.255.0
   broadcast: 192.168.4.255
   dns-server: 192.168.4.200
   dns-server: 192.168.4.207
   router: 192.168.4.1
   --- end of options ---
 
DHCP packets received on interface eth0: 1
DHCP packets received on interface dummy0: 0
DHCP packets received on interface lo: 0
DHCP packets received on interface wlan0: 0

and ..

The developer's general stance is he is using stock Adrino/ESP libraries to handle all the networking, so it must be something odd with my network, which infers PiHole as that's the only arguably non-standard part. However, he provided this:

So to recap (as its been a few days :-)), the ESP will not connect using a stock router with PiHole as the sole DNS, or with PiHole as both DNS on 2 IP addresses (as above). It will only connect with a non-pihole DNS as either or both DNS entries in the router.

It also makes no difference changing upstream DNS servers within PIHole, getting the same results if I use Cloudflare, Google or, as it usually is, 127.0.0.1#5053.

All my other devices connect (using the same router and hence DNS config) without issue.

Appreciated :+1:


I know from many that they are using Tasmota-devices on their home network. I do as well for roller shutters. Looking into their source code (completely open), I see the same as has been quoted by the developer you spoke to, quoting some relevant lines:

#include <ESP8266WiFi.h>

WiFi.hostname(local_hostname);

WiFi.begin(ssid, password);


So it becomes actually difficult to find out what is going wrong where. One further question maybe:

I'm sure you tried this already, however, just asking again to be sure: Have you verified that Pi-hole is actually replying to DNS requests on both interfaces?

Also, could you maybe repeat the tcpdump testing with either the Pi-hole and the router and send me the recorded pcap via PM? It'll be a lot easier for me to check for the differences when loading in Wireshark compared to looking at the textual report of tcpdump.

yes I concluded it was from the following dhcp-discover in my earlier post:

I ran tcpdump for ports 67 and 86 on PiHole, changed my router to use just PiHole (I know the ESP is OK with just one DNS, so long as it isnt PiHole :-)) and Im about to PM you the resulting dump file.

OK, so far I don't think Ive been too bad. I think its time for a dumb question .... Ummmm, how do I PM? Im expecting to see a mail icon near your avatar or something. Can I even send one or do I need some stars and stripes first or something?

Check the avatar again please.

1 Like

I didn't mean DHCP, I really meant if you run on your Pi-hole dig google.com @192.168.4.200 and dig google.com @192.168.4.207 - if both return a result. But let's first have a look on your tcpdump.


You can also change how you reply to this post by setting you want to send a message

Screenshot from 2021-04-14 08-44-39

PM is fixed, thankyou.

OK Ive PMd the tcpdump. I had my router set with only PiHole as DNS (ESP is OK with one DNS) and the ESPs leds and offline status both confirmed it was trying to connect during the dump. As soon as I added a valid external DNS to the router it connected to wifi and came online.

It's also worth noting that I accidentally discovered from the developer, when querying why by chance I found the ESP off-line, that "if it cant ping the server it retries the connection". By sever he means his server thats used to control and monitor devices controlled by the ESP. Its clearly still pihole as DNS that upsets the ESP though.

For completeness, here are the dig outputs

; <<>> DiG 9.11.3-1ubuntu1.13-Ubuntu <<>> google.com @192.168.4.200
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58771
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com.			IN	A

;; ANSWER SECTION:
google.com.		56	IN	A	216.58.196.142

;; Query time: 25 msec
;; SERVER: 192.168.4.200#53(192.168.4.200)
;; WHEN: Thu Apr 15 08:44:47 AEST 2021
;; MSG SIZE  rcvd: 65

and


; <<>> DiG 9.11.3-1ubuntu1.13-Ubuntu <<>> google.com @192.168.4.207
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17207
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com.			IN	A

;; ANSWER SECTION:
google.com.		248	IN	A	142.250.76.110

;; Query time: 34 msec
;; SERVER: 192.168.4.207#53(192.168.4.207)
;; WHEN: Thu Apr 15 08:45:56 AEST 2021
;; MSG SIZE  rcvd: 65

Unfortunately Im away down the Australian coast for 4 days, which Id love to tell you about but its off-topic except to say I wont have my laptop or network with me :slight_smile:

Oh, this is a valuable hint. So if it cannot send telemetry home, it rejects the Internet connection? Interesting (bad) behavior... So next thing we do after you return is checking if Pi-hole is actively blocking the necessary telemetry domain.

Have fun! Australia feels just too far away from me to go there myself.

Yeah it is interesting! During the gap (aside from my trip) I convinced him it was a silly way of doing things. So now it doesnt reboot if it cant ping the server.

I dont think its getting as far as pinging his server, it never goes online (he claims a red LED indicates wifi connectivity, which seems to coincide with observation). The status LED stays green (alive but offline).

Regardless, Ive captured two packets from it as I reboot it after making PiHole the only DNS in my router. It sends this once, then stays offline (apparently a different way of handling failure to connect than a reboot!).

During this time PiHole query log shows only 2 blocked entries for telemetry.dropbox, and none (blocked or otherwise) from the IP the box comes up with when it gets a DNS it likes.

So it still looks to me that theres something about PiHole DNS that it doesnt like, sufficient it decides not to connect at all. Something different from google, my ISP, Cloudflare which all work as a single DNS entry.

Im happy to leave him figuring out what, but Im puzzled how it would react differently from PiHole.

Anyway Ill PM you the tcpdump, the two records in there read back as from the correct MAC address of the device.

Yeah Australia is a bit far, and worse still you'd first have to sit in a hotel room for 2 weeks staring at a wall :slight_smile:

But how does it even know it is a Pi-hole? I wonder if it may just reject internal IP addresses for DNS servers at all. Can you confirm this?

Well I agree. But as per earlier discussions, the developer claims the network code is all standard library. He doesn't get involved ...

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