-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Handing out NO gateway via DHCP? #1372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This doesn't have anything to do with ESP32, but simple TCP/IP behavior. The stack will use whichever route it thinks will get it to the destination address. If your ESP is using a private address (eg, the default softAP address of 192.168.4.1), then your phone will route requests to that network through the softAP. All other traffic will go through the mobile network. Are you saying that if you have mobile on that you cannot get to a webserver running on the ESP, but as soon as you turn it off you can get there? The "sign in to network" captive portal from WiFiManager is just a redirect to that address. |
Sadly, that's not how it seems to work on Android, even though that should
be the standard behaviour, and my computers do it that way.
Android does seem to block routing to a network that doesn't have internet
access, probably as an anti-spoofing measure. i.e. I can't seem to route 192.168.4.1/24 to the softAP, while using the mobile data connection as the default gateway.
|
Here's someone with the same problem on ESP8266: And someone recommended trying |
I commented out |
@schweini I use the ESP soft AP with Android and I cannot confirm your problem. when i connect to the softap, my phone tells me that, this AP does not seem to provide an internet connection and if you want to connect anyway. after clicking yes, everything works as expected. I have mobile data ON all the time. this is on a Nexus from LG with Android 8.0 |
This is potentially very good news!
Can you confirm that:
A) you can browse to the ESP32's IP (while it is in AP mode)
B) at the same time navigate the general internet
?
If yes, which sketch are you running? Because the standard Captive Portal
example does cause the problem for me.
Does you program cause the "sign in to network" popup?
I'm sorry that I'm being nosy, but I don't seem to be the only person
encountering this problem - but on the other hand, it doesn't seem to be as
common a problem (there are even links to Android java functions to remedy
this via connection manager) as I'd think.
P.S.: I'm running LineageOS 7.1.2
|
yes.
no. But I did not expect B) to work. I obviously misunderstood your issue. I read it as 'you cannot reach the ESP AP as long as you have mobile data enabled'. but you have a point. if the default gateway still points to the mobile data interface, it might be possible to have both. |
I'm looking for this functionality on a different downstream project from the ESP-IDF (Pycom), is this functionality already available in the IDF and this issue is regarding Arduino implementation? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This stale issue has been automatically closed. Thank you for your contributions. |
Did anyone ever find a solution to this. I am struggling with that too ATM. I can either connect to the ESP32 AP and access the webserver it provides but can NOT browse the internet on the phone or the the other way around. This seems to be an Android issue though. |
@no-trick-pony Did you figure anything out this past month? |
FWIW, I was able to disable the offering of a gateway by changing
I've only tested on iOS, but I find that it causes the phone to be able to communicate on the Config AP and on the internet via cellular. It does have the unfortunate side-effect of preventing the iOS app from viewing the current SSID (something Apple surprisingly allows the app to do), however the app can still attempt to communicate with the device via its IP address. |
Hi! here you mentioned filepath to |
I am trying to get my Android phone connected to my ESP32, while at the same time maintaining my mobile connection.
The problem seems to be that Android simply routes all traffic over the mobile data connection, until it is sure that the wifi network provides internet connectivity.
(strange side node: the WebView inside the 'sign in to network' pop-up can see the ESP32 - no other browser can. Only if I disable mobile data, can I use a browser to visit the ESP32's IP)
I suspect (but am not sure) that Android doesn't trust an AP that defines a default gateway, but offers no internet connectivity.
I would like to, therefore, NOT hand out a default gateway address over DHCP when my phone connects.
Is there a way to do this? Or some line I could quickly comment out for testing if this actually works?
The text was updated successfully, but these errors were encountered: