Bridging Ethernet for Nodes with ESP-MESH-LITE

snoblet
Posts: 4
Joined: Fri Aug 22, 2025 2:11 pm

Bridging Ethernet for Nodes with ESP-MESH-LITE

Postby snoblet » Fri Aug 22, 2025 2:26 pm

Hello,
We use some ESP32 devices with esp-mesh-lite library, the root is connected to a WIFI Access Point.
https://github.com/espressif/esp-mesh-lite

Following the examples (rainmaker, mesh_local_control), the root and the nodes can access to Internet, throught the NAPT of the mesh library.
https://github.com/espressif/esp-mesh-l ... ansmission

Our ESP32 devices have an Ethernet Interface, with a Raspberry PI connected on it.
Our goal is to provide Internet access to the Raspberry PI.

To achieve it, we have to create a bridge (L2 or L3) between the Ethernet interface of the node, and the Mesh-Lite interface.
The ESP-IOT-Bridge have examples of bridging on different interfaces (usb, spi, modem...)

But for the esp-mesh-lite interface, we didn't succeeded to make it work.
What you think about the feasibility of our feature ?
Is there some limitation about the mesh-lite netif ?

Best regards
Stéphane

nopnop2002
Posts: 362
Joined: Thu Oct 03, 2019 10:52 pm
Contact:

Re: Bridging Ethernet for Nodes with ESP-MESH-LITE

Postby nopnop2002 » Mon Aug 25, 2025 11:25 am

A simple esp-iot-bridgr SoftAP Interface can accept HTTP requests from the RPI.
https://github.com/espressif/esp-iot-br ... ifi_router

esp-mesh-lite uses esp-iot-bridge, but the SoftAP interface of esp-mesh-lite only accepts connections from the ESP-IDF station interface.
All nodes in esp-mesh-lite must be built with ESP-IDF.
So even if you connect an RPI to the esp-mesh-lite SoftAP Interface, you will not be able to access the Internet.


The http client on esp-idf works fine.
HTTP packets from leaf nodes are forwarded through the root node.

Code: Select all

                                   ESP32
+-----------+                  +-----------+
|           |<--HTTP packets-->|HTTP client|
|           |                  |   root    |                      ESP32
|HTTP server|                  |           |                  +-----------+
|           |                  |           |                  |HTTP client|
|           |<--HTTP packets-->|<=========>|<--HTTP packets-->|   leaf    |
+-----------+                  +-----------+                  +-----------+

snoblet
Posts: 4
Joined: Fri Aug 22, 2025 2:11 pm

Re: Bridging Ethernet for Nodes with ESP-MESH-LITE

Postby snoblet » Mon Aug 25, 2025 2:53 pm

Hi,
Thanks for the reply.
The RPI is connected to the leaf node with Ethernet.
As the leaf node can reach Internet, we think it is possible to share the Internet connection to the RPI,
With a bridge L2 or L3.

Code: Select all

                                   ESP32
+-----------+                  +-----------+
|           |<--HTTP packets-->|HTTP client|
|           |                  |   root    |                      ESP32                                    RPI
|HTTP server|                  |           |                  +-----------+                           +-----------+
|           |                  |           |                  |HTTP client|                           |HTTP client|
|           |<--HTTP packets-->|<=========>|<--HTTP packets-->|   leaf    |<--Ethernet Bridge L2/L3-->|           |
+-----------+                  +-----------+                  +-----------+                           +-----------+
We want retransmit the packet received by Ethernet to the root node via the mesh netif
But we should have to add some routing L3 / bridging L2 stuff.
If it is L3 routing, we have to check if the leaf node can have an IP address.
If it is L2 routing, we don't know if the RPI talk in IP with root, or with Internet Wifi Hotspot

snoblet
Posts: 4
Joined: Fri Aug 22, 2025 2:11 pm

Re: Bridging Ethernet for Nodes with ESP-MESH-LITE

Postby snoblet » Tue Aug 26, 2025 7:54 am

Hi,
Finally it work, with a L3 bridge
All nodes have IP addresses in the mesh network,
We enabled CONFIG_BRIDGE_DATA_FORWARDING_NETIF_ETHERNET,
And called :

Code: Select all

ip_napt_enable(ip_info.ip.addr, 1);
or

Code: Select all

esp_bridge_create_all_netif();
By calling esp_bridge_create_all_netif, DNS also are initialized.
Best regards
Stéphane

nopnop2002
Posts: 362
Joined: Thu Oct 03, 2019 10:52 pm
Contact:

Re: Bridging Ethernet for Nodes with ESP-MESH-LITE

Postby nopnop2002 » Thu Aug 28, 2025 12:40 am

Awesome!!

If possible, could you please share the entire code?

snoblet
Posts: 4
Joined: Fri Aug 22, 2025 2:11 pm

Re: Bridging Ethernet for Nodes with ESP-MESH-LITE

Postby snoblet » Thu Aug 28, 2025 10:26 am

Hi
The code is the mesh-local-control example based on IOT-Bridge project
If my comprehension is correct, this example set-up a DHCP server on all wifi-mesh lite node,
To give IP for the mesh childs.
So all nodes have his own IP with gateway + DNS.
To share the Internet connection of the node to the Ethernet port for RPI,
We just enabled the CONFIG_BRIDGE_DATA_FORWARDING_NETIF_ETHERNET configuration,
And RPI got Ethernet (with DHCP, gateway, DNS OK)
Best regards
Stéphane

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot], meta-externalagent and 1 guest