Connect two routers with a VPN over the Internet

Hi everyone,
I have a Home Assistant installation at one place and want to connect smarthome devices securely over the internet from another place. I was thinking of using two OpenWRT routers connected through wireguard. However I am not very familiar with wireguard and vpn's in general.

I want something like a "network switch over a VPN". So when I connect to that router I am automatically connected to the network on the other end. I have made a diagram to hopefully make it bit clearer.

So basically when I connect a device to the "OpenWRT router 2" it is in the same network as the first router with just a different IP adress that is in the range of 192.168.9.xx instead of 192.168.1.xx so I can differentiate which device is connected where. I know I can setup every device individually through wireguard, but with microcontroller based smarthome devices like ESP32 it is not that easy.

Is it possible to do something like this. It doesn't have to be wireguard perse, but I thought that would be the best option. Any suggestions on how to do this is welcome.

1 Like


Your on the right track keeping each network different. Internal wireguard needs own ip as well. In my tunnel I give it completely different IP address ( as long as they are not same network on any other device).

Download all the wireguard software and set up new interface. on openwrt router 1 and Openwrt router 2

Takes bit of trial and error but it is workable. I have 2nd Openwrt router as a travel router so can use anywhere. I have set Home network as something different than 192.168.1.1 as most hotels have used that network and then it wont work.

If you want to contact esp32 on openwrt router 2 then better to set router 2 as server and router 1 as client if you don't want to set up each device individually.

1 Like

There are tested and working WireGuard how-tos: server + client + site-to-site.

1 Like

Thanks for the quick replies. I will look into it this weekend and see if I can set something up.

1 Like

Thanks, it works now. I used the server and client setup and then the site-to-site tutorial.
One router has the IP-address of 192.168.9.1 and the other one 192.168.9.2 and have the client router giving IP-addresses in the range of 192.168.3.x so every device is automatically connected through DHCP

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.