andr13 / ESP32-Web-WireGuard

ESP32 Wireguard Hall Sensor
BSD 2-Clause "Simplified" License
11 stars 2 forks source link

Tunnel connection is not established #3

Open B3-ta opened 3 months ago

B3-ta commented 3 months ago

Hi @andr13

After I was looking for a VPN solution for the ESP32 for a long time, I came across your post on YouTube.

I downloaded your fork of the lib and adapted the example code from ESP-WG-Web.ino with my Wireguard credentials.

The sketch can be installed, the web server can be reached on the internal IP address in the WiFi. However, the Wireguard Tunnel is not established

However, according to the console output, the tunnel is established. No client is shown as connected on the Wireguard server.

Connecting to WiFi... Local IP: 192.168.5.200 WireGuard IP: 192.168.37.3 Initializing WG interface... OK

The user configuration on the Wireguard server is okay, I can log in with the data using a Windows client.

Can the log level be expanded? Or do you have an idea why the tunnel isn't being built?

Thank you Christian

andr13 commented 3 months ago

Hello, @B3-ta 👋🏻

I have also personally experienced this behavior as well. This and other problems are mainly due to the fact that the current version of the sketch does not imply any logic for reconnection in case of possible failures or trivial packet loss. In my personal experiments I solved this by changing the access point to one that was in close proximity to the ESP32. I also often had to manually restart the board 2-3 times to get a successful connection. You can also read #2, where the situation was solved by reducing the distance to the router

This is a demo sketch, and honestly - I didn't expect it to interest so many people. But since it is, I will take this sketch and improve the connection logic and logging as well. Unfortunately, I probably won't be able to do it before the weekend, so I can't promise quick results

Regards, Andrii Zakharov

B3-ta commented 3 months ago

Hello Andrii,

Thank you for your quick response. I would really appreciate it if you could optimize the script. Unfortunately, I can't really program myself and therefore like to fall back on existing projects.

The ability to connect an ESP32 to my network via VPN simply opens up a huge number of new application scenarios.

Unfortunately, the attempts mentioned in #2 did not lead to any improvement for me.

During the test, the ESP was only about 2 meters away from the access point and had good WiFi Signal. The local website was also accessible without any problems.

There was simply no Wireguard connection established. Unfortunately, I have no way of viewing the log files on the other side. The Unifi Gateway somehow doesn't offer any option for this.

I am therefore happy to wait for your update of the sketch.

Regards, Christian