Page 1 of 1

Port NAT to ESP32?

Posted: Thu Jun 15, 2017 5:15 am
by wxz2006621
Hi,

I understand that esp32 is not planned to be a router. But I really want some router features so that the stations connected to esp32's AP can browse the internet via esp32's STA. I have looked into this project https://github.com/martin-ger/esp_wifi_repeater which brings NAT to esp8688(by using his own NAT enabled lwip https://github.com/martin-ger/esp-open-lwip).

I'm stuck when I try to port that project to esp32. The issue is all dns queries get no response, but ICMP type3 code3(port unreachable). It seems that the udp port that sent the request, was shut down before received the response. I guess esp32-wifi-lib has something to do with it however it is closed source project. Any idea? Walkaround?

I'm thinking to capture DNS packet received from esp32's AP netif and use esp32's STA netif to resend it. then capture the DNS response and forward.

I'm a newbie in this felid. If I get something wrong, just correct me:)

There is another lwip_nat projecthttps://github.com/ajaybhargav/lwip_nat. tried, cannot get it work. but it has a really good code style.

my repo(merge martin-ger's lwip)https://github.com/Derek-X-Wang/esp-idf

Re: Port NAT to ESP32?

Posted: Thu Jun 15, 2017 9:18 am
by ESP_Sprite
FWIW, as far as I know the closed-source wifi drivers are a layer *under* icmp/udp/.., so if you are getting an ICMP message on an UDP packet, the likelyhood of the closed source WiFi libs to play a role is slim to none.

Re: Port NAT to ESP32?

Posted: Sat Nov 25, 2017 6:40 am
by hfc108
hi wxz2006621:
I use https://github.com/ajaybhargav/lwip_nat to implement NAT function. In ESP32,the can transport ping、udp and tcp packet. Wireshark capture correct packet,but PC appcation can receive the packet.