Hi everyone,
I'm trying to setup a WireGuard tunnel with OpenWrt, but I just can't get routing working.
I mostly followed https://openwrt.org/docs/guide-user/services/vpn/wireguard/server, but my setup is a little different: The OpenWrt device (some old TP-Link router) isn't the main router, but a dump Wifi AP and supposed future WireGuard "server". The WAN port is consequently not being used. My main router is a AVM Fritz!Box. I therefore already configured a static route for the private VPN network and a port forwarding rule for 51820/udp on the Fritz!Box targeting the OpenWrt device, adapting https://openwrt.org/docs/guide-user/services/vpn/wireguard/extras#split_gateway.
My ultimate goal is allowing three common use cases:
- WireGuard clients should be able to route all their traffic through the VPN,
- WireGuard clients should be able to connect to other devices in my LAN, and
- WireGuard clients should be able to connect their LAN with the server's LAN (i.e. a site-to-site config following https://openwrt.org/docs/guide-user/services/vpn/wireguard/site-to-site).
Use cases (1) and (2) correspond to "Client 2" below, use case (3) corresponds to "Client 1". For now I just want to get (1) and (2) working (i.e. I'm connecting "Client 2").
Since the original setup from the wiki didn't work, I created a separate firewall zone with masquerading, but still no luck. Here's the config I came up with:
Local network: 10.69.42.0/24
IP address of AVM Fritz!Box (main router): 10.69.42.1
IP address of OpenWrt device ("WireGuard server"): 10.69.42.2
WireGuard network: 10.162.83.0/24
# /etc/config/network (snippet)
config interface 'lan'
option proto 'static'
option ipaddr '10.69.42.2'
option netmask '255.255.255.0'
option gateway '10.69.42.1'
option ip6assign '64'
list dns '10.69.42.1'
option device 'br-lan'
config interface 'wg0'
option proto 'wireguard'
option private_key '…'
option listen_port '51820'
list addresses '10.162.83.1/24'
list addresses 'fdd7:9be5:32c9:fe63::1/64'
config wireguard_wg0
option description 'Client 1'
option public_key '…'
option preshared_key '…'
option persistent_keepalive '25'
list allowed_ips '10.162.83.2/32'
list allowed_ips 'fdd7:9be5:32c9:fe63::2/128'
list allowed_ips '10.136.162.0/24'
option route_allowed_ips '1'
config wireguard_wg0
option description 'Client 2'
option public_key '…'
option preshared_key '…'
option persistent_keepalive '25'
list allowed_ips '10.162.83.3/32'
list allowed_ips 'fdd7:9be5:32c9:fe63::3/128'
# /etc/config/firewall (snippet)
config zone 'lan'
option name 'lan'
list network 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
config zone 'wg'
option name 'wg'
list network 'wg0'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
config forwarding
option src 'wg'
option dest 'lan'
The WireGuard handshake works (i.e. clients can connect to the WireGuard "server"; wg show
on the client indicates a successful handshake and the client's kernel dyndb log shows that it receives keep alive packages from the "server"), but I can't route any traffic through the tunnel (I can't even ping 10.162.83.1 from the client).
Any hints what is missing?