Connecting to ESP32 based board WiFi different network

Jojopidosa
Posts: 1
Joined: Tue Jul 31, 2018 11:56 am

Connecting to ESP32 based board WiFi different network

Postby Jojopidosa » Tue Jul 31, 2018 12:28 pm

Hi Everyone

I have a project where I control motor from a mobile phone or a computer using ESP32 DOIT DEVKIT.
I can connect to the board ONLY when my phone or computer and the ESP32 DOIT DEVKIT are on the same network.
When in different networks, there is no connection, and that does not become very useful.

Any help will be highly appreciated.

Thanks

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

Re: Connecting to ESP32 based board WiFi different network

Postby ESP_Sprite » Wed Aug 01, 2018 8:39 am

Yes, they can't connect because they are in different networks. if there's no communication path between these two networks, the ESP32 can't magically create one. If both networks do have Internet access, you could either use a server accessible by both networks to act as a proxy of some sorts, or set up the network the ESP32 is on to set up port forwarding to make some port on the ESP32 accessible from the outside.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Connecting to ESP32 based board WiFi different network

Postby Ritesh » Tue Sep 22, 2020 1:20 pm

ESP_Sprite wrote:
Wed Aug 01, 2018 8:39 am
Yes, they can't connect because they are in different networks. if there's no communication path between these two networks, the ESP32 can't magically create one. If both networks do have Internet access, you could either use a server accessible by both networks to act as a proxy of some sorts, or set up the network the ESP32 is on to set up port forwarding to make some port on the ESP32 accessible from the outside.
Hello,

Is it possible to use OpenVPN or Tiny VPN service inside ESP32 to connect or access ESP32 based device from different network like Virtual LAN concept?

So that all devices have different physical IP Address but with same Virtual IP Addresses it can be access using VPN.

Let me know if possible with ESP32 as well
Regards,
Ritesh Prajapati

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

Re: Connecting to ESP32 based board WiFi different network

Postby ESP_Sprite » Wed Sep 23, 2020 11:27 am

Technically, yes, this is possible. I don't think anyone has implemented yet, though.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Connecting to ESP32 based board WiFi different network

Postby Ritesh » Wed Sep 23, 2020 12:01 pm

ESP_Sprite wrote:
Wed Sep 23, 2020 11:27 am
Technically, yes, this is possible. I don't think anyone has implemented yet, though.
Hello,

Thanks. I agreed but would you please share some details if you have any idea? Because for VPN, there should be support into LWIP Library and into network stack itself.

As far as i know that light weight LWIP Library and Stack is used into ESP32.

I went through few links which I found below

https://github.com/husarnet/husarnet-esp32
https://husarnet.com/
https://www.hackster.io/donowak/control ... net-fa9634
https://github.com/adamkrawczyk/esp32_rosserial_demo
https://github.com/martin-ger/MQTT_VPN
https://forum.arduino.cc/index.php?topic=567137.0
https://esp-forum.de/index.php/forum/ko ... it-openvpn
https://www.reddit.com/r/esp32/comments ... pn_server/

But I just want to know that it is feasible as per capabilities of ESP32 with memory and stack point of view? Because VPN or Virtual Network is generally ported into Linux or High variant MCUs.

I haven't heard or didn't see it to use for low memory devices like ESP32 and other tiny MCUs.

Let me know if you have any idea or any example for same
Regards,
Ritesh Prajapati

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: Connecting to ESP32 based board WiFi different network

Postby PeterR » Wed Sep 23, 2020 12:16 pm

You may find it easier to use a Cloud service e.g. an MQTT server.
You could create topics using the ESP MAC or some other unique hash (the ESP mqtt client already defaults its client id to MAC NIC).

Then your PC/Phone would PUBLISH its commands to the MQTT server.
Your ESP would SUBSCRIBE to its unique hash/NIC topic root.

You would need to use a Cloud service but that does not have to cost.
You would be up and running very quickly & if you structure the communication API properly you could replace with your VPN latter.
& I also believe that IDF CAN should be fixed.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Connecting to ESP32 based board WiFi different network

Postby Ritesh » Wed Sep 23, 2020 3:02 pm

PeterR wrote:
Wed Sep 23, 2020 12:16 pm
You may find it easier to use a Cloud service e.g. an MQTT server.
You could create topics using the ESP MAC or some other unique hash (the ESP mqtt client already defaults its client id to MAC NIC).

Then your PC/Phone would PUBLISH its commands to the MQTT server.
Your ESP would SUBSCRIBE to its unique hash/NIC topic root.

You would need to use a Cloud service but that does not have to cost.
You would be up and running very quickly & if you structure the communication API properly you could replace with your VPN latter.
Yes. MQTT already we are using into our application to send data over cloud which you have mentioned earlier.

But I don't have any idea like how to use it with VPN.

So I need help for that as per our requirements.
Regards,
Ritesh Prajapati

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: Connecting to ESP32 based board WiFi different network

Postby PeterR » Wed Sep 23, 2020 6:01 pm

Why do you need VPN if you have MQTT & a cloud server?

The MQTT server acts as 'the man in the middle'. No one needs to know anyone elses address. You can all have private addresses!
All you need to know is the server's address & your product serial number (or MAC or whatever you use to uniquely topic name).

VPN is your suggestion and one of many potential solutions to the original use case (actually I think link management would be hard for you if you were creating a product with many installs). You then went on to find that a VPN sofware might be hard to find for the ESP. So move on! Use another solution (e.g. MQTT)!
Simples ;)

PS There are the usually security concerns & as this is a motor it might be wise to consider them.
& I also believe that IDF CAN should be fixed.

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: Connecting to ESP32 based board WiFi different network

Postby PeterR » Wed Sep 23, 2020 7:40 pm

@Ritesh

Also quite confussed as to if your question:
Is it possible to use OpenVPN or Tiny VPN service inside ESP32 to connect or access ESP32 based device from different network like Virtual LAN concept?
is a new question or if this thread remains about the OP's question.

You should raise a fresh topic if you have a VPN question as otherwise potentially a diversion from the OP.
& I also believe that IDF CAN should be fixed.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Connecting to ESP32 based board WiFi different network

Postby Ritesh » Wed Sep 23, 2020 10:49 pm

PeterR wrote:
Wed Sep 23, 2020 7:40 pm
@Ritesh

Also quite confussed as to if your question:
Is it possible to use OpenVPN or Tiny VPN service inside ESP32 to connect or access ESP32 based device from different network like Virtual LAN concept?
is a new question or if this thread remains about the OP's question.

You should raise a fresh topic if you have a VPN question as otherwise potentially a diversion from the OP.
Thanks.

I will raise seperate request for same.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: No registered users and 93 guests