NTP Client-Server: Get Date and Time works with DHCP and fails with fixed IP.
Does anybody know why?
Many thanks for your help
https://pastebin.com/nFddRD9k
Hi.
That’s a known issue with time and static IP.
Unfortunately, I’m not sure exactly what is the solution.
I recommend taking a look at these discussions and checking if any of the suggestions work for you: https://forum.arduino.cc/t/esp32-cannot-connect-to-ntp-server-with-fixed-ip/591181/12
https://forum.arduino.cc/t/timentp_esp8266wifi-breaks-if-ip-address-is-fixed/667185/4
https://forum.arduino.cc/t/problem-using-static-ip/1067239/3
I hope this helps.
Regards,
Sara
Hi Sara, many thanks for your fast reply.
Meanwhile I found out that it works with:
IPAddress primaryDNS(8, 8, 8, 8); //optional
IPAddress secondaryDNS(8, 8, 4, 4); //optional
WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)
Probably misfunction has something to do with timeout.
Kind regards from Peter
Great.
Thanks for sharing the solution.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara
Hi Sara, a final remark to your book Build Webservers with ESP32 and ESP8266. I worked it through with great interest and want to congratulate you to the clearness of the presentation.
One short remark to page 572: 8. Then, you can go to the root (/) URL to access the new web server. This is false since the new firmware has changed the IP Adress. I worked with fixed IP’s which is OK