Page 2 of 2
Re: internet unavailable when connected to AP(Wi-Fi) of ESP32 DevKit,
Posted: Thu Feb 28, 2019 8:52 am
by WiFive
Code: Select all
IP4_ADDR(&info.gw, 192, 168, 1, 1);//ESP acts as router, so gw addr will be its own addr
Set this to 0 otherwise your phone will try to send internet traffic there
Re: internet unavailable when connected to AP(Wi-Fi) of ESP32 DevKit,
Posted: Thu Feb 28, 2019 11:42 am
by Ritesh
Code: Select all
IP4_ADDR(&info.gw, 192, 168, 1, 1);//ESP acts as router, so gw addr will be its own addr
Set this to 0 otherwise your phone will try to send internet traffic there
Hi WiFive,
I have one query like iOS device can get internet connection from ESP32 when it is connected with ESP32 device into AP mode?
Let me correct what I understood is like below
1) iOS device doesn't has any internet connection
2) ESP32 Device is working as AP mode
3) iOS Device is trying to connect with ESP32 device and trying to get internet connection with that
or let me correct if I understood something wrong?
Re: internet unavailable when connected to AP(Wi-Fi) of ESP32 DevKit,
Posted: Thu Feb 28, 2019 12:23 pm
by WiFive
No it is like
1) iOS device has cellular internet connection
2) ESP32 Device is working as AP mode
3) iOS Device is trying to connect with ESP32 device and trying to keep internet connection from cellular
Re: internet unavailable when connected to AP(Wi-Fi) of ESP32 DevKit,
Posted: Thu Feb 28, 2019 1:01 pm
by Ritesh
No it is like
1) iOS device has cellular internet connection
2) ESP32 Device is working as AP mode
3) iOS Device is trying to connect with ESP32 device and trying to keep internet connection from cellular
Ok. Understood.
Then Internet connection should be remained as it is into iOS phone even if after connecting that iOS device with ESP32 into AP mode.
Re: internet unavailable when connected to AP(Wi-Fi) of ESP32 DevKit,
Posted: Wed Feb 10, 2021 4:21 pm
by jcsbanks
Interesting about the Garmin device. What device is it? Does it prevent hijacking the internet connection on both iOS and Android?
Here's what I have after struggling with this as well. It seems to work for iOS, but not always working in Android.
this is in main() before initializing WiFi:
Code: Select all
tcpip_adapter_init();
{
tcpip_adapter_ip_info_t info = {0};
tcpip_adapter_dns_info_t dns_info = {0};
IP_ADDR4(&dns_info.ip, 0, 0, 0, 0);
IP4_ADDR(&info.ip, 192, 168, 4, 1);
IP4_ADDR(&info.gw, 0, 0, 0, 0);
IP4_ADDR(&info.netmask, 255, 255, 255, 0);
ESP_ERROR_CHECK(tcpip_adapter_dhcps_stop(TCPIP_ADAPTER_IF_AP));
ESP_ERROR_CHECK(tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_AP, &info));
dhcps_dns_setserver(&(dns_info.ip));
uint8_t opt_val = 0; // don't supply a dns server via dhcps
//ESP_ERROR_CHECK(tcpip_adapter_dhcps_option(TCPIP_ADAPTER_OP_SET, TCPIP_ADAPTER_DOMAIN_NAME_SERVER, &opt_val, 1)); // don't supply a dns server via dhcps
ESP_ERROR_CHECK(tcpip_adapter_dhcps_option(TCPIP_ADAPTER_OP_SET, TCPIP_ADAPTER_ROUTER_SOLICITATION_ADDRESS, &opt_val, 1)); // don't supply a gateway (router) via dhcps option 3
ESP_ERROR_CHECK(tcpip_adapter_dhcps_start(TCPIP_ADAPTER_IF_AP));
}
Hope it helps.
Trying either option on ESP IDF 3.3 still results in there being a DNS server on 192.168.4.1, but the gateway on 192.168.4.1 disappears. Android still doesn't use cellular in this case.
Re: internet unavailable when connected to AP(Wi-Fi) of ESP32 DevKit,
Posted: Wed Feb 10, 2021 8:54 pm
by jcsbanks
https://github.com/espressif/esp-idf/bl ... er.c?#L355
Since I could only set DNS to 0.0.0.0 and that didn't work for Android I also commented out the 13 lines from the link and then in Windows no IPV4 DNS servers are shown. Gateway also not shown. Not sure it makes any difference though as Android 9 still doesn't want to use cellular when connected to ESP32 WiFi though. Developer options set include "Mobile data always active".
Re: internet unavailable when connected to AP(Wi-Fi) of ESP32 DevKit,
Posted: Wed Feb 10, 2021 10:06 pm
by WiFive
Re: internet unavailable when connected to AP(Wi-Fi) of ESP32 DevKit,
Posted: Tue Jun 06, 2023 6:12 am
by dynek=
Hey,
Has anyone every succeeded in having both mobile/cellular internet connectivity + ESP32 in AP mode (without Internet) on Android devices?
Looks like the following make it so I can at least access the ESP32, but mobile connectivity is not working anymore:
Code: Select all
uint8_t opt_val = 0; // don't supply a dns server via dhcps
ESP_ERROR_CHECK(tcpip_adapter_dhcps_option(TCPIP_ADAPTER_OP_SET, TCPIP_ADAPTER_DOMAIN_NAME_SERVER, &opt_val, 1));
Cheers
Re: internet unavailable when connected to AP(Wi-Fi) of ESP32 DevKit,
Posted: Tue Jun 06, 2023 9:04 pm
by MicroController
This Q/A suggest that you may be able to do it by disabling DHCP for the respective SSID and removing the gateway IP address in Android's WiFi config. Or by "skipping" Android's prompt when first connecting to the internet-less WiFi. Might give that a try.