Page 1 of 1

Confirm Correct Usage

Posted: Wed Aug 19, 2020 12:21 am
by sasha_awair
Hi All,

I have an ESP32 board.

An external device connects to the ESP32 board via PPP. The ESP32 board also connects the internet via an ethernet connection.

I am trying to provide an internet connected to the PPP-connected device via the ESP32's ethernet connection.

I have decided to use your experimental NAPT implementation in the esp-lwip repository from the link here.
https://github.com/espressif/esp-lwip/c ... 17a5577e3f

I did however have severe difficulty getting NAPT to route packets from the PPP connection to the wider internet ethernet-based connection. I believe it is because of the statically-chosen IPs used for the PPP module whereas the LWIP forwarding looks at the IPs and netmasks (which for PPP is I assume all set bits).

To get this working, I had to comment out the following definit in the 'lwipopts.h' file.
#define LWIP_HOOK_IP4_ROUTE_SRC ip4_route_src_hook

I also had to set the following define:
#define ESP_IP4_ROUTE 0

Now I am wondering, what are the consequences of doing so? Why were these included in the first place.

I would like to ensure that this will not cause any issues down the line.


Regards,
Alex

Re: Confirm Correct Usage

Posted: Fri Dec 09, 2022 7:47 am
by mknezic
Hi Alex,

Have you, by any chance, confirmed that those changes are safe to proceed with.

I am trying a similar usecase: sharing Ethernet connection to Internet through PPP link by enabling NAT. However, I am facing difficulties to achieve this, as the changes you mentioned does not help and the connection is not shared.

Below are steps I've made so far.

1. On one ESP enable PPP server support in lwIP stack, define static IP addresses for PPP interface (by setting his and our address), and call

Code: Select all

pppapi_listen()
instead

Code: Select all

pppapi_connect()
.

2. On the other ESP (which is connected to the first one via PPP link), I used PPP interface as usual (in client mode). It will get IP address from PPP server once connected.

3. On the first ESP I enable NAPT by calling

Code: Select all

ip_napt_enable()
once the interface is up and running.

However, I do not have Internet access. I understand that you managed to make it work, so any suggestion would be highly appreciated.

Regards,

Mladen