How to Set Up WireGuard VPN on OpenWRT Routers with VPNUK

Setting up WireGuard® VPNUK on OpenWRT Routers

This guide will help you set up WireGuard VPN on an OpenWRT router using the VPNUK service. This allows secure, encrypted VPN access for all devices connected to your network.

Prerequisites:

  • A router running OpenWRT (version 19.07 or later recommended)
  • VPNUK account login and server details
  • SSH access to your router

WireGuard® configuration download

Please login using the VPN login username and password from the vpn account you would like to configure.
Click Here to download your WireGuard® configuration file, which is compatible with all devices.

IMPORTANT NOTES: A WireGuard® connection is currently only compatible with our Dedicated IP accounts. Each configuration file is generated automatically, twice per hour, the process can take up to 20 minutes to complete, it can therefore sometimes take up to 1 hour for a new configuration file to be created on new accounts. If you are a new user please allow the system time to generate your configuration file.

1: Install WireGuard on OpenWRT

  1. Log in to your OpenWRT router’s web interface:
    1. Open a browser and go to http://192.168.1.1/
    2. Log in with your root credentials
  2. Navigate to System > Software
  3. Click Update lists to refresh the package repository
  4. Install WireGuard by running the following command via SSH or the LuCI web interface:
    opkg update
    opkg install wireguard wireguard-tools kmod-wireguard luci-app-wireguard
  5. Once installed, restart your router

2. Download Your VPNUK WireGuard Configuration File

  1. Click here to download the WireGuard configuration file from our server.
  2. Log in with your VPNUK VPN account login usernamd and password.
  3. The system will fetch your WireGuard configuration file from the VPNUK server.
  4. Save it to your computer.

3. Configure WireGuard on OpenWRT

  1. Go to Network > Interfaces
  2. Click Add new interface
  3. Set the Name to wg0
  4. Select Protocol: WireGuard VPN
  5. Click Create Interface

4. Configure WireGuard VPN Settings

  1. Under General Settings, enter:

    • Private Key: (Copy from vpnuk-wg.conf)
    • Listen Port: 51820
  2. Under Peers, click Add and enter:

    • Public Key: (Copy from vpnuk-wg.conf)
    • Allowed IPs: 0.0.0.0/0, ::/0
    • Endpoint Host: (Copy from vpnuk-wg.conf)
    • Endpoint Port: 51820
    • Persistent Keepalive: 25
  3. Click Save & Apply

5: Configure Firewall & Routing

  • Go to Network > Firewall
  • Create a new zone:
    • Name: VPN
    • Input: Accept
    • Output: Accept
    • Forward: Reject
    • Masquerading: Enable
    • MSS Clamping: Enable
    • Covered Networks: Select wg0
  • Click Save & Apply

6: Enable & Start WireGuard VPN

Run the following command in SSH to bring up the WireGuard interface: wg-quick up wg0
Then check your new IP address is your unique VPNUK IP.

Enjoy Secure VPN Access with VPNUK & WireGuard on OpenWRT Routers

Did this guide help? Please provide us with feedback here or share it with others looking for a secure VPN setup on OpenWRT Routers!

Optional Settings

1. Enable Auto-Start for WireGuard VPN

To ensure WireGuard VPN starts automatically on OpenWRT:

  1. Run this command:
    /etc/init.d/network restart
    /etc/init.d/network enable

Troubleshooting Common Issues

Cannot connect to VPNUK servers?

  1. Ensure your WireGuard configuration file is correct and up to date, we would always recommend fetching a new configuration file from our server if you are unable to connect. Click here to download a new configuration file.
  2. Try restarting your router and modem (if applies)
  3. Check if your ISP is blocking VPN connections

VPN is connected, but no internet?

  1. Open WireGuard and go to your tunnel settings.
  2. Ensure AllowedIPs = 0.0.0.0/0, ::/0 is set correctly.
  3. Try disabling IPv6 in your router settings (if applicable)

“WireGuard” and the “WireGuard” logo are registered trademarks of Jason A. Donenfeld. WireGuard® is available and should always be updated from the developers website at wireguard.com