-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
DHCP Options in AP mode #1956
Comments
In user_interface.h there is wifi_softap_set_dhcps_offer_option(), which, as far as I can tell, controls whether to send routing-information to clients or not. I have not tried this, but after calling WiFi.begin() calling wifi_softap_set_dhcps_offer_option() might work. |
@Manawyrm did this solution work for you? |
I unfortunatly can't test it at the moment, because I have lent out the ESP with the electronics to another team member who is developing on the hardware side of things. Sorry for the delay and keeping this open for so long! |
The code to include various options is here: |
Is there any clear method to customize the DHCP Configuration in ESP8266 Arduino? Thanks! |
@NarinLab Take a look at http://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/soft-access-point-class.html#softapconfig -- if you specify the ESP8266's IP-address as e.g. 192.168.43.1, the function softAPConfig() sets the DHCP-range as 192.168.43.100 - 192.168.43.200. If you want to customize the range further, I recommend taking a look at https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp and setting the DHCP-server up manually. |
Thankyou very much, Problem solved by:
|
@Manawyrm did you get this to work? I'm also stuck on getting my Android phone to simultaneously connect to the network 192.168.4.1/24 via wifi, and the rest of the internet via mobile data. |
extern "C" { const char *ssid = "NightVisionAP"; void setup() { uint8 mode = 0; Serial.print("IP address:\t"); void loop() { } |
NarinLab is right Previously, in the standard examples, when I used the following configuration, there was no problem. IPAddress ip(192, 168, 1, 1); But if I changed the IP address, the connection in some mobile phones was constantly disconnected and reconnected, but in some phones it worked only a little slowly. I came to the conclusion that in the ESP8266 12F in access point mode, the IP address and the gateway must be the same. I used similar configurations below and they all worked IPAddress ip(192, 168, 4,10); Maybe in the access point mode, the ISP has the task of the gateway. So both addresses must be the same. Of course, I don't have enough knowledge of the network! Thanks to NarinLab for the interesting idea |
Hi,
with the ESP in AP mode, it acts as a DHCP server.
when doing that, it hands out IP addresses to any client and also it tells them network information like the DNS servers and gateways.
And thats exactly my problem. When a DHCP server hands out DNS server and default route-adresses, a mobile device like my android smartphone will try to use the ESP8266 as a router to get to the internet -- which will of course fail.
This could be prevented by not sending the DHCP options 3 and 6.
Screenshot: https://screenshot.tbspace.de/vetdnfuhizk.png
Is there anyway to disable or configure the DHCP payload which is sent by the ESP?
Thanks,
Tobias
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: