Port NAT to ESP32?

wxz2006621
Posts: 1
Joined: Thu Jun 15, 2017 4:33 am

Port NAT to ESP32?

Postby wxz2006621 » Thu Jun 15, 2017 5:15 am

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

ESP_Sprite
Posts: 9709
Joined: Thu Nov 26, 2015 4:08 am

Re: Port NAT to ESP32?

Postby ESP_Sprite » Thu Jun 15, 2017 9:18 am

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.

hfc108
Posts: 13
Joined: Sat Sep 03, 2016 3:23 pm

Re: Port NAT to ESP32?

Postby hfc108 » Sat Nov 25, 2017 6:40 am

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.

Who is online

Users browsing this forum: Google [Bot], MicroController and 179 guests