Hi,
I would like to create a wifi bridge between two networks - a server on my home network, and one or more ethernet clients on a small rover. I would like to use the LR-mode as I value range over throughput in this use case.
My idea was to setup one ESP32 in AP-STA mode, with STA connecting to my home wifi, and the softAP in LR mode. The rover would also have an ESP32 in LR STA mode, with an ethernet module connected to one or more ethernet clients.
Sketch of the setup below:
I have tried out AP_STA and also tried out an ESP32 NAT implementation, however what I would really like is to have Layer 2 functionality, where the ethernet clients in the rover transparently (as in bridging) communicate with the base network.
Anyone tried this? Does the ESP32 IDF support this use-case?
Layer 2 bridging
-
- Posts: 290
- Joined: Wed Sep 05, 2018 6:23 am
Re: Layer 2 bridging
I would say it's doable, and esp-idf has a very simple example showing how to bridge Wi-Fi and Ethernet on Layer II https://github.com/espressif/esp-idf/tr ... net/eth2ap
Re: Layer 2 bridging
The thing to remember is that in Wifi, packets usually only have three addresses, bssid, src and dest.
This means we can do bridging to ethernet ONLY in AP mode, not in STA mode, because there aren't enough address fields.
Commercial wifi extenders use another mode, typically called WDS mode, which has four addresses.
So I think you can do it only if you put the esp32 on your rover into AP mode. This is what the espressif bridging example does.
--
EDIT: to clarify, you can't using bridging on both sides unless you use four-address packets, because there will not be enough address fields. I don't know if the expressif libraries can do this.
It should still be possible to set up the esp32 as a ip router though, and route packets, which should work. What's the problem with that?
This means we can do bridging to ethernet ONLY in AP mode, not in STA mode, because there aren't enough address fields.
Commercial wifi extenders use another mode, typically called WDS mode, which has four addresses.
So I think you can do it only if you put the esp32 on your rover into AP mode. This is what the espressif bridging example does.
--
EDIT: to clarify, you can't using bridging on both sides unless you use four-address packets, because there will not be enough address fields. I don't know if the expressif libraries can do this.
It should still be possible to set up the esp32 as a ip router though, and route packets, which should work. What's the problem with that?
-
- Posts: 2
- Joined: Sun Sep 13, 2020 12:44 pm
Re: Layer 2 bridging
Thanks, I'll look into this.ESP_morris wrote: I would say it's doable, and esp-idf has a very simple example showing how to bridge Wi-Fi and Ethernet on Layer II https://github.com/espressif/esp-idf/tr ... net/eth2ap
Got it, thanks.markxr wrote: So I think you can do it only if you put the esp32 on your rover into AP mode. This is what the espressif bridging example does.
While I have been working a lot with FreeRTOS on other CPUs, I'm new to ESP32, so I'm not yet familiar with the capabilities of the IC. My gut feeling told me that sticking to L2-bridging would take a lot less horsepower from the CPU, however as I'm not too concerned with throughput maybe routing would work just finemarkxr wrote: It should still be possible to set up the esp32 as a ip router though, and route packets, which should work. What's the problem with that?
Re: Layer 2 bridging
Looking at what you're trying to do, it does seem a bit complicated an unlikely. Given that you won't be able to bridge in both AP and STA mode, and the esp32 does not support WDS mode, it might be a better idea to either simplify your topology, or try something a bit simpler,
Maybe port forwarding would be ok, or running some kind of proxy (socks proxy?) that your client / server applications can use?
It seems the esp32 network stack is not as flexible as, say, Linux.
IP routing should work, but I can't see how to easily enable that, lwip does support it if enabled at compile time, but there is no esp-idf config option to turn it on.
Maybe port forwarding would be ok, or running some kind of proxy (socks proxy?) that your client / server applications can use?
It seems the esp32 network stack is not as flexible as, say, Linux.
IP routing should work, but I can't see how to easily enable that, lwip does support it if enabled at compile time, but there is no esp-idf config option to turn it on.
Who is online
Users browsing this forum: No registered users and 142 guests