WireGuard on OpenWRT with local DNS

Nobu

[H]F Junkie
2FA
Joined
Jun 7, 2007
Messages
14,735
So I finally got around to setting up WireGuard VPN on my router, so I can access my home network while I am away (via ipv4/ipv6, dynamic dns isn't set up yet, ip not static)

It wasn't hard, but because I had some specific criteria I wanted fulfilled, it wasn't exactly straight-forward either.

I wanted access to DNS on a server in the LAN from my wg client.
I wanted access to the WAN from wg.
I did NOT want to allow access to any other devices on the LAN (including the router and it's interface)

Enabling WireGuard itself is fairly easy, I followed the guide on the OpenWRT wiki: https://openwrt.org/docs/guide-user/services/vpn/wireguard/server#luci_web_interface_instructions

From there I also enabled "Route Allowed IPs" in the wg peer settings and created a few more firewall traffic rules in this order:

From wgzone to "this device": block (drop)
From wgzone to LAN <DNS Server IP> port 53: accept
From LAN <DNS Server IP> port 53 to wgzone: accept
From wgzone to LAN (any): block (drop)

The wgzone rules are accept all, per the guide, so maybe some of my rules are unnecessary. But it works -- I cannot access the router interface or devices other than the DNS server at port 53 and of course the wireguard server, when connected via wg.

It's maybe a bit extreme, considering I have shared key encryption and a preshared key for my device, but it keeps the riffraff out in the worst case.

Edit: I haven't figured out how to assign ipv6 addresses to wg clients yet, but I probably just have to change a wg setting.

Feel free to post your critiques, experiences with other VPNs, etc.

Edit2: Just had to add a list of allowed ipv6 addresses to the peer config which was in the same subnet as the router wg interface to get ipv6 working. 👍
 
Last edited:
Back
Top