Comments (12)
Since release 2.6.0 NAPT/NAT is part of the standard distribution. See also this example: https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/RangeExtender-NAPT/RangeExtender-NAPT.ino
Okay, that's ESP8266, not ESP32... (don't know about ESP32)
from esp32_nat_router.
oh god how good it would be
from esp32_nat_router.
Guess you can do that using Arduino as a component of the ESP-IDF: https://github.com/espressif/arduino-esp32/blob/master/docs/esp-idf_component.md
In the IDF menuconfig use these setting also:
https://github.com/martin-ger/esp32_nat_router#building-the-binaries
from esp32_nat_router.
I'm gonna check on this! Thanks.
from esp32_nat_router.
Do you have some hints on how to integrate that like in the esp8266 release 2.6.0? I want to add this functionality to some other project that it is using platformio, but I am not sure how to compile your code and make it accessible to platformio exactly.
Thank you!
from esp32_nat_router.
The NAT feature is actually included in ESP8266 Arduino, have a look here:
https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/RangeExtender-NAPT/RangeExtender-NAPT.ino
from esp32_nat_router.
Thank you @martin-ger ! This is exactly what I want to approach but for the ESP32, not for the ESP8266, but for the ESP32 the lwip libraries are not available like in this example and I am not sure how to integrate them.
Do you know how could I make your awesome libraries accessible to Arduino core for the ESP32?
from esp32_nat_router.
Okay, I understand. The later ESP32 Arduino core includes the lwip_napt.h from the esp-idf ( https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/esp32/include/lwip/lwip/src/include/lwip/lwip_napt.h ).
So I guess it is included in liblwip and you can just include and call it. Haven't tried this so far.
If not, the libs are built without this option on. Then I would try to build the lib with esp-idf an copy it over.
from esp32_nat_router.
Thank you @martin-ger for your tips! As you mention, I had to re-build esp-idf libs after enabling IP forwarding and NAT so I can access to lwip_napt.h added in the latest ESP32 Arduino core.
I have created this example esp32_lwip_nat_example using my fork for arduino-esp32 framework where I have enabled the LWIP lib. It compiles successfully, however, it is still missing the last part to provide DNS to dhcp server. It looks that the core also contains the dhcpserver however if I try to call the dhcps_set_option_info()
and dhcps_dns_setserver()
functions, the compiler fails to link the libraries giving the errors:
undefined
reference to `dhcps_set_option_info(unsigned char, void*, unsigned int)'
undefined
reference to `dhcps_dns_setserver(ip_addr const*)'
With this example, I can connect the esp32 as a station and I can also connect devices to it, but they don't get internet connection.
Do you know how could I also configure the AP dns to fit with the station dns?
from esp32_nat_router.
Does it change anything if you include "dhcpserver/dhcpserver.h" and "dhcpserver/dhcpserver_options.h" as "extern "C" { ... }?
from esp32_nat_router.
I think that the libraries are included correctly directly here (no errors while compiling) but I tried adding:
extern "C" {
#include "dhcpserver/dhcpserver.h"
#include "dhcpserver/dhcpserver_options.h"
}
And it also includes the libraries correctly but if I uncomment the functions dhcps_set_option_info
and dhcps_dns_setserver
I still get the linking errors.
I am not sure if this lwip/apps/dhcpserver/dhcpserver.c is perhaps not added correctly into the sdk libraries?
from esp32_nat_router.
I have found the solution to accomplish the last part to provide DNS to DHCP server. The solution is described in this arduino-esp32 issue #5117.
You can also check the working example at this repo: esp32_lwip_nat_example
from esp32_nat_router.
Related Issues (20)
- Slow HOT 1
- Can't build binaries for ESP32S2
- build error HOT 1
- Portmapping Not Working After First Reboot/Startup HOT 1
- Esp32
- configuration help HOT 1
- esp 32 not syncing . not able to flash the firm ware
- how to clear command history?
- Porting for RTL8720DN
- I can't connect to esp32c3 HOT 5
- Future Requests: add custom mac & hostname
- do not build this project
- No module named kconfgen
- NO XMC flash detected! HOT 1
- No internet connection from nat router HOT 7
- esp32s3 can not fiund router HOT 1
- the kconfigs.in and kconfigs_projbuild.in files could not be found HOT 1
- can i install this in esp8266 HOT 1
- ESP32S3. - Should this hardware work HOT 1
- how to connect eduroam(WPA2-enterprise)?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp32_nat_router.