2

I have an ESP32 wroom32 that has WiFi internally and an ethernet port. I want to be able to connect my phone to the WiFi and access a webserver running on the ethernet port. Schematically this looks like:

PC ----------------------- ETH (ESP32) <----NAT?----> Wifi (ESP32)------------ Phone

The PC has static IP: 192.168.2.150 ETH (ESP32) has static ip 192.168.2.100 Wifi (ESP) has dhcp enabled, subnet: 192.168.4.x

I am able to configure the Wifi and the ethernet part to initialize. The ETH side has a static ip and the Wifi side has DHCP to assign an IP to the phone.

I use ESP-IDF running RTOS framework to develop my application. And I have been searching the internet for possible solutions to this problem. I have found suggestions that to connect both interfaces (ETH and Wifi) I need something like NAT running on the ESP. However there is no current implementation of this.

I only want to access a specif webserver page running on the PC (access through 192.168.2.150:8000), this makes me think that it should be possible to have a very simple forwarding function that forwards between Wifi and ETH.

At the moment I am not sure how to start. If my idea is even possible or if there are alternatives to implement what I want.

Final: I have been able to implement the ETH2Wifi example, but this connect both interfaces and disabling the functionality of the access pint

2
  • 1
    Why do you think you need NAT (Network Address Translation)? this is basic IP routing. Also why bother with the ESP32 when you can just stick a USB wifi adapter in the PC (assuming it doesn't already have a Wifi adapter)
    – hardillb
    Feb 1, 2019 at 16:17
  • I will look into ip routing but I thought that to transfer packets between interfaces you need more than routing. For simplicity I namend it above a pc, however in reality it is another embedded device that cannot be changed. It is a sensor measuring some values. I want to add some other sensors to it with the ESP + wifi connection on that is on the ESP.
    – Steven
    Feb 3, 2019 at 12:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.