Saturday, March 20, 2021

Setting up Wireguard on OpenWRT

 Here are steps I used for setting up Wireguard connection on my OpenWRT router.

1) Install required packges.

opkg install wireguard luci-app-wireguard

2) Go to NETWORK -> INTERFACES and add a new interface with WireGuard VPN as its protocol.

 

3)  Fill in the deteails as supplied by your VPN provider, e.g.

 

 

4) Go to FIREWALL  - > GENERAL SETTINGS -> ZONES, and edit the WG zone to allow forwarding from the LAN zone. Also tick the boxes for Masquerading and MSS clamping. You may want to remove WAN forward from your WAN interface too.  With WAN removed from the LAN, you connection will get cut when the VPN drops, i.e. a kill switch.


 


 

This is it. With my GL-MT300N-V2 (19.7.7), the speed jumps from 1.2MB/s with OpenVPN to 4.8MB/s with WireGuard.


n.b. If you can't connect after the above steps, you may want to restart your WAN interface / the whole router.

It is possible to limit the devices which are using the WireGuard by deploying policy routing similar to below.