-
Notifications
You must be signed in to change notification settings - Fork 7.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
How to configure DHCP server to provide DNS to AP to use esp32 as a repeater using LWIP NAT feature #5117
Comments
Have you seen this? |
Yes, thank you @chegewara. I also have seen this other example: RangeExtender-NAPT.ino which I am actually trying to approach the same thing but using an esp32 instead of an esp8266. Both examples are made for esp8266 :( |
Sorry, i mean this: |
Yes, also this example is useful. It is made for esp32 in this case but using esp-idf framework and I look forward to create an example using this arduino-esp32 framework with platformio. The example that you shared also use the dhcps_set_option_info and dhcps_dns_setserver on those lines, and those are the functions that I am trying to use as I mentioned in the description but I have errors while linking and I don't know how to add that part |
You need to include the header where that function is defined. In this case, at least <dhcpserver/dhcpserver.h> |
Thank you @lbernstone. The header is already included in the example that I am doing at this line https://github.com/paclema/esp32_lwip_nat_example/blob/main/src/main.cpp#L26. With VScode I can also check that it is imported correctly and I can navigate successfully to this file. However, appears the error that I mention at the end of the building process when It is linking. |
You have some incompatibility between your compiled libraries and your code. You are running gcc 8.4, but the code you are trying to run is for IDF 3, which should use gcc 5.2. If you don't understand what I am talking about, this is going to be very difficult for you to implement. |
Which arduino-esp32 version are you using? From description it is v1.0.6, but you are using code that is not enabled in that version. That header is from master branch: |
I am using a fork from this repo arduino-esp32 adding the "Enable IP forwarding" and "Enable NAT" feature from the esp-idf. I followed the steps explained in the esp32_lwip_nat_example readme to rebuild the sdk for the esp32 using the esp32-arduino-lib-builder. This fork recompiling the sdk was the only method I could find to get the IP_NAPT defined, if not I am not able to use the lwip/lwip_napt.h functions because these sdk functions are not enabled by default. I am going to check if there is some mismatch with the IDF version |
It is really hard to help if you are providing inconsistent information about your setup. |
Sorry, this was not so clear for me. Since my fork is at the top of the current master branch, I suppose that the version is v2.0.0-alpha1 + LWIP nat lib https://github.com/paclema/arduino-esp32/commits/lwip_enabled |
You enabled few options in sdkconfig/menuconfig. Best way to test if changes are aplied is to test in code by checking with
|
Yes, I made that test with
I have added that and "all should works". Also as I said, I can What should be the correct version for the IDF and gcc using 2.0.0-alpha1? From the commits comments of the 2.0.0-alpha1 release I can see |
Ok, i see what is wrong. That header file is nor C++ compatible: You have to add header with:
|
I tried adding:
And it also includes the libraries correctly but if I uncomment the functions I am not sure if this lwip/apps/dhcpserver/dhcpserver.c is perhaps not added correctly into the sdk libraries? |
You seem to not have |
Also tried to defined within platformio.ini build_flags or main.cpp code and the result was not successful. Although I am not sure if it should also be defined before compiling the sdk. |
Yes, most likely before compiling sdk with builder. |
I tried to build the sdk enabling this |
I have found the solution based on this post:
You can check how I could configure properly the example in this part: https://github.com/paclema/esp32_lwip_nat_example/blob/main/src/main.cpp#L120 Using those functions the linking errors do not appear (because I don't use those functions anymore :P) and I have tested that stations connected to the ESP32 AP can get internet access too. I wonder if in the future @me-no-dev IP forwarding and NAT will be enabled by default for the LWIP component (as described in the readme fo the example). In that case, I could add this example to this repo if you would consider it useful. Until then, as it is written in the description, I am using a for of this framework with the esp32 sdk recompiled enabling these features. |
Hello @paclema. I have been looking for this for weeks. The unique difference is that I would need to have this implemented in Arduino and I wonder if you know the way to make this up. Thank you so much for sharing this, it gives me a lot of hope!! :) |
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
Hello @paclema. Add the following directives to the "dhcpserver.h" to solve the link issues: after initial includes: before final #endif: |
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future. |
Is that issue already solved? I am interested to enable the IP_NAPT in my platformio esp32 |
I am also interested in using IP_NAPT in my arduino-ESP32 development environment. |
Hello, as there was no answer in more than 14 days, I'm closing the issue as expired to keep our backlog manageable. If it's still needed, please reopen the issue. Thanks for understanding. |
@VojtechBartoska Hello, could you let us know what the state of this is?
You were asking this, but I don't see that NAPT has been enabled for 2.0.3-RC |
Hardware:
Board: mhetesp32minikit
Core Installation version: v2.0.0-alpha1 forked: https://github.com/paclema/arduino-esp32/commits/lwip_enabled
IDE name: Arduino IDE with Platform.io
Flash Frequency: 40Mhz
Upload Speed: 115200
Computer OS: Windows 10
Description:
I am trying to create an example for esp32 to use it as WiFi repeater using the recent features of LWIP NAT with arduino-esp32 framework and platform.io.
The example is posted in this repo: esp32_lwip_nat_example
As you can see described in steps within the readme, to approach this I had to re-compile the esp-idf sdk to enable LWIP NAT options in order to be able to access to lwip_napt.h methods.
It looks that the ESP32 can be connected as a station and provide the AP, but the devices that I connect to the ESP32 do not get internet and I am not sure how I should configure the DHCP server to provide the DNSs received on the station.
I tried to call dhcps_set_option_info and dhcps_dns_setserver to configure it like in this esp-idf example esp-idf-nat-example but I have the next errors while linking:
How should I configure the dhcp server to provide correctly the DNSs to the AP?
It looks that the dhcpserver.h it is available but I am not sure how can I call it and configure it.
Thank you!
The text was updated successfully, but these errors were encountered: