I have reviewed the threads which are similar already
- OpenWrt Wireguard Client site to site Ubuntu - Wireguard Server
- OpenWrt WireGuard VPN client to my OpenWrt Wireguard VPN Server on my home router
I have also gone through the docs https://openwrt.org/docs/guide-user/services/vpn/wireguard/start
What I want to do I have a cottage and want to install some IoT devices there. Those devices need to be able to see my home network (MQTT broker) to report status and get commands.
What I have working I have a wireguard server setup. Multiple client devices can connect to this wireguard and access my home network (including the MQTT broker).
I've also installed wireguard on the cottage OpenWRT router. I can see from the wireguard server that a connection is being made. Looking at the status of the wireguard "client" on the cottage OpenWRT router it looks like it agrees, and that the wg0
device is connected.
What I'm stuck on I can't seem to get traffic from a device connecting to the cottage OpenWRT router to flow over the wireguard connection.
I think there are two key 'config' files - but I'm happy to share more to help investigate this
/etc/config/network
config interface 'wg0'
option proto 'wireguard'
option private_key 'SECRET='
config wireguard_wg0 'wgserver'
option public_key 'SECRET='
option preshared_key 'SECRET='
option endpoint_host 'mydomain.com'
option endpoint_port '51820'
option route_allowed_ips '1'
option persistent_keepalive '25'
list allowed_ips '192.168.0.0/22'
This seems to be the key thing to get wireguard to setup and to connect.
/etc/config/firewall
config zone 'lan'
option name 'lan'
list network 'lan'
list network 'wg0'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
This is simply my moving the 'wg0' device into the lan zone.
Looking at the admin web interface routes https://openwrt.lan/cgi-bin/luci/admin/status/routes
Active IPv4 Routes
Network Target Gateway Metric Table Protocol
wan 0.0.0.0/0 192.168.10.1 0 main
wg0 192.168.0.0/22 - 0 main
lan 192.168.9.0/24 - 0 main
wan 192.168.10.0/24 - 0 main
wan 26.246.8.195 192.168.10.1 0 main
It may help to know that my hardware setup.
I'm using a KuWifi LTE router. That's configured to be 192.168.10.1
My OpenWRT router uplink port is plugged into the back of the KuWifi. The OpenWRT router is 192.168.9.1
.
My home network is running on 192.168.1.1
and 192.168.2.1
- the MQTT server lives at 192.168.1.88
It feels like I'm really close -- but I can't seem to get it quite right.