mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1544] dns does not look to be set properly after connecting to wifi #1318
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1318
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @BouchardClaude on GitHub (Jan 8, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1544
Basic Infos
I appear that the dns is not set properly when using DHCP STA , preventing to communicate with services using dns name.
Description
When using autoconnect, the ip, mask and gateway are set properly, but it look like the dns is never set. I'm not sure if its a desired behaviour or if its linked to WifiManager itself or a sub library.
Additional libraries:
Sketch
Exemple of code that produce the ouput
will output the following:
Debug Messages
And ill be able to use anything not using DNS.
Is theyre a way to hard-set the DNS without using static ip?
@EtoTen commented on GitHub (Jan 13, 2023):
Try
also try
( from https://github.com/espressif/arduino-esp32/issues/2990 )
@tablatronix commented on GitHub (Jan 13, 2023):
What esp lib version?
And what is your DNS supposed to be ?
@tablatronix commented on GitHub (Jan 13, 2023):
Works for me
@BouchardClaude commented on GitHub (Jan 13, 2023):
Thanks for the help :)
Okay so first I completly misunderstood the dnsIP() usage in c++. @EtoTen thanks to your snippet i was able to confirm that I'm receiving the DNS ip correcly.
To test it, I try to sync the time.
and it gave me this ( everything look look ip wise, but it fail to set the time ( or to do any dns query that I tested)
but if I dont use dns, then its working ( so packets are going in and out and are forwareded properly by the router.
example: using timeSync("GMT-5", "129.6.15.28v", "128.138.141.172");
The funny thing is I tried with a different network and it worked just fine ( exemple using my cell as wifi AP and using dns to sync time)
timeSync("GMT-5", "time-a-g.nist.gov", "utcnist2.colorado.edu");will work perfetly:
Can it be that the issue is with the subnet I use internally confliting with the one used when in portal mode?
I cannot exclude something fishy with the router too, but every device I have use this with no issue.
@tablatronix commented on GitHub (Jan 13, 2023):
Yeah or it could be subnet mask not allowing that ip, not sure. also just use .toString() for printing ips.
@BouchardClaude commented on GitHub (Jan 13, 2023):
thats why im suspecting a bug, cause 192.168.4.1 255.255.252.0 is a valid subnet and 192.168.5.35 is a valid ip in this subnet
If I take the same (non working ) router setup and change the mask of the network to be a /24 then everything is working good
[22:27:41] WiFi connected - IP = 192.168.0.26
[22:27:41] MAC-ADDRESS: 3616196358xxx
[22:27:41] DNS - IP = 192.168.0.1
[22:27:41] GW - IP = 192.168.0.1
[22:27:41] GW - IP = 255.255.255.0
Syncing time
Synchronized time: Sat Jan 14 03:27:41 2023
So I think the network mask is unproperly process OR the 192.168.4.x range is conflicting with something, but thats unlikely since at that point its in STA mode
@tablatronix commented on GitHub (Jan 14, 2023):
There is a way to change the default server ip but I forget at the moment how. Would be interesting to test a different class. Ill try to test this in my lab one day.
@patrickvorgers commented on GitHub (Jan 15, 2023):
It seems to me that I have the same problem. I added the WiFiManager to one of my programs and without it my MQTT broker (mqttbroker) is resolved normally but with WiFiManager I can only use the IP-number directy.
17:45:20.990 -> *WM: 192.168.0.131
17:45:20.990 -> DNS: 192.168.0.200
17:45:20.990 -> GW: 192.168.0.200
17:45:20.990 -> GW subnet mask: 255.255.255.0
The strange thing is that when I look in my Mikrotik router that the DNS request (wireShark) for both the working and failing programs look exactly the same. For one request the Mikrotik router returns the IP and for the other it doesn't.
@BouchardClaude commented on GitHub (Jan 16, 2023):
That's interesting cause its the exact same issue for me (MQTT broker) , but your mask is /24 so I was probably wrong thinking its related to mask.
Funny part is I tried many time, and sometimes it work, sometimes no with the same setup .. so so far its not easy to point a finger on whats not working. I'm working on trying to be able to reproduce the issue every time so we can see what element is causing the issue