WireGuard Setup guide for OpenWrt (2024)

OpenWrt WireGuard Setup Guide

This guide was produced using OpenWrt v.23.05

Installing required packages

  1. In your router’s webUI, navigate to System - Software, click Update lists.

  2. In the Filter field, type WireGuard, locate and install the wireguard-tools, kmod-wireguard, and luci-proto-wireguard packages.
    WireGuard Setup guide for OpenWrt (1)

  3. Restart your router.

Creating an Interface

  1. Generate a WireGuard config file with the preferred server and parameters. Extract the archive, open the file with any text editors and copy its contents.

    WireGuard config file generator is only available for accounts that were created after November 2020 (account ID format: i-XXXX-XXXX-XXXX). If you have an IVPN subscription created before this date (account ID format: ivpnXXXXXXXX) and wish to make use of the feature, contact our customer service to help you make the switch.

  2. In OpenWRT, navigate to Network - Interfaces, click on the Add new interface. Give it any name, e.g. ivpnAustria, set Protocol to WireGuard VPN, then click on the Create interface button.

  3. In the General Settings tab, click on the Load configuration... button, paste the contents of the WireGuard config file from step 1 and click on the Import settings button.
    WireGuard Setup guide for OpenWrt (2)

  4. In the Advanced Settings tab, set MTU to 1412.

  5. In the Peers tab, click Edit next to the imported peer configuration, check the Route Allowed IPs option, set Persistent Keep Alive to 25 and click Save.
    WireGuard Setup guide for OpenWrt (3)

  6. Click Save & Apply.

Adding a Firewall zone

  1. Navigate to Network - Firewall

  2. Click the Add button and enter the following configuration:

    • Name - Give it any name, e.g. ivpn_fw
    • Input - Reject
    • Output - Accept
    • Forward - Reject
    • Masquerading - Checked
    • MSS clamping - Checked
    • Covered networks - select the previously created VPN tunnel interface, e.g. ivpnAustria
    • Allow forward to destination zones - Unspecified
    • Allow forward from source zones - lan
      WireGuard Setup guide for OpenWrt (4)
  3. Click Save & Save & Apply

Configuring a Kill-switch (optional)

To ensure the traffic on your LAN devices travels strictly via the VPN tunnel and to prevent any possible leaks if the router disconnects from the VPN server for any reason, edit your lan firewall zone and remove WAN from the Allow forward to destination zones field, then click Save & Save & Apply buttons.
WireGuard Setup guide for OpenWrt (5)

DNS

  1. Navigate to Network - Interfaces

  2. Click on the Edit button next to the WAN interface

  3. In the Advanced Settings tab, uncheck the Use DNS servers advertised by peer and enter the WireGuard regular DNS server IP address (172.16.0.1) or the one associated with the preferred AntiTracker list.
    WireGuard Setup guide for OpenWrt (6)

  4. Click Save.

  5. If your ISP additionally provides you with an IPv6 IP address, repeat steps 2 to 4 for the WAN6 interface.

  6. Click Save & Apply.

Final Steps

  1. A device reboot is not required, though it may be useful to confirm that everything behaves as expected.
  2. Run a leak test at https://www.dnsleaktest.com via one of the internal network clients attached to your OpenWRT router.
WireGuard Setup guide for OpenWrt (2024)

FAQs

How to set up WireGuard on OpenWRT? ›

Once logged in, click on System and select Software. On this page, you will download the WireGuard package. To do so, click on Update lists. Once the lists are updated, in the search field type WireGuard, and install the WireGuard package first, following with luci-app-wireguard.

How to easily configure WireGuard? ›

You can set up WireGuard VPN tunnel by just following the 5 main steps given below:
  1. Download and install WireGuard for both server and clients.
  2. Generate cryptographic key pairs(Public and private keys) for both server and clients.
  3. Configure WireGuard tunnel interfaces on both server and clients.
May 13, 2024

What is the best VPN server for OpenWRT? ›

Best VPNs for OpenWrt:
  • NordVPN: My number one choice for OpenWRT routers. ...
  • Surfshark: This is a great budget option that still offers powerful features. ...
  • ExpressVPN: This is another solid OpenWRT option. ...
  • PrivateVPN: This is a newer service that has servers in around 63 countries.
Jan 5, 2024

How to setup WireGuard on DD WRT router? ›

Once you log into the router panel, go to the Setup tab and select Tunnels. Click on Add Tunnel. Click on Enable next to the Tunnel setting, and select WireGuard as your protocol. Once selected, click Save.

How to configure VPN in OpenWrt? ›

OpenWrt OpenVPN Setup Guide
  1. In your router's webUI, navigate to System - Software , click Update lists.
  2. In the Filter field, type OpenVPN, locate and install openvpn-openssl & luci-app-openvpn packages.
  3. Restart your router.

Which is more secure, WireGuard or OpenVPN? ›

While WireGuard is generally faster, OpenVPN provides heavier security.

How do I setup a manual WireGuard connection on my router? ›

Go to Setup > Tunnels > and click the Add Tunnel button. Choose Enable and select WireGuard from the dropdown menu. Set the MTU value of the WireGuard tunnel to 1412 . Click the Generate Key button and go to the Client Area on the IVPN website to add the generated public key to the Key Management area.

How to tell if WireGuard is working? ›

To view the status of one or more WireGuard tunnels, use the show wireguard [<instance>] command. This command prints the status of all WireGuard tunnels and can optionally limit the output to a specific instance.

How do I activate WireGuard automatically? ›

Autostart WireGuard in systemd
  1. Generate a valid and working WireGuard configuration file /etc/wireguard/wg0. ...
  2. Add the WireGuard service to systemd: ...
  3. Start the new service immediately: ...
  4. Reboot your computer system to verify the automatic connection on startup works as expected.
  5. Check the service status:

Which is the most stable OpenWrt version? ›

The current stable version series of OpenWrt is 23.05, with v23.05.3 being the latest release of the series. It was released on 25. March 2024.

Does OpenWrt support VPN clients? ›

The goal is to allow all clients connected to OpenWrt by default to use the Main Router's internet, but clients that set the OpenWrt Router as the gateway should have their traffic routed through the VPN client running on the OpenWrt Router. So far I've managed to set up the OpenWrt Router as a VPN Client.

Which VPN is faster than OpenVPN? ›

Both OpenVPN and WireGuard are really secure open-source VPN protocols, if properly implemented. However, WireGuard is newer and faster than OpenVPN, because it was designed with modern devices and processors in mind. It is also easier to maintain.

How to configure WireGuard? ›

  1. Step 1: Expose Wireguard VPN Server to the Internet. Your Public IP Address. ...
  2. Step 2: Setup Wireguard VPN Server. Install the wireguard software and dependencies. ...
  3. Step 3: Setup client connections. ...
  4. Step 4: Setup clients. ...
  5. Step 5: Test Connection.
Sep 29, 2023

What ports do I need to forward WireGuard? ›

Port Forwarding
  • Http on port 80.
  • Https on port 443.
  • Postfix SMTP on port 25.
  • Postfix SMTPS on port 465.
  • Postfix Submission on port 587.
  • Dovecot IMAP on port 143.
  • Dovecot IMAPS on port 993.
  • Dovecot POP3 on port 110.

What is the difference between DD-WRT and OpenWrt? ›

DD-WRT is mostly available on older routers with more up-to-date software than the manufacturers provide. If you're ready to take the next step in customization or just want to use hardware that doesn't make sense for DD-WRT, such as using a thin client PC as a router, OpenWrt is the answer.

How do I use WireGuard on my router? ›

Go to [VPN] > [VPN Server] > enable and click [WireGuard® VPN] > click add button. 4. For general devices like laptops or phones, you can just click the Apply button.

How to use pbr OpenWrt? ›

PBR app
  1. Install and enable PBR app. ...
  2. Create rules with a lower numeric priority value when using Tailscale. ...
  3. Disable gateway redirection in the VPN client configuration. ...
  4. Forward WAN port to a webserver running on 192.168. ...
  5. Prioritize routing between local subnets 192.168.
Oct 16, 2023

How to set up a WireGuard firewall? ›

Firewall Rules
  1. Navigate to Firewall > Rules, WAN tab.
  2. Click Add to add a new rule to the top of the list.
  3. Use the following settings: Action. Pass. Interface. WAN. Protocol. UDP. Source. any. Destination. WAN Address. Destination Port Range. (other), 51820. Description. Pass traffic to WireGuard.
  4. Click Save.
  5. Click Apply Changes.
Apr 3, 2024

How do I run a WireGuard server? ›

  1. Installing the server components. Update your local system. Install the toolchain.
  2. Download and compile the wireguard module.
  3. Download and compile the wireguard tools (wg, etc.)
  4. Initial configuration. Key generation. ...
  5. Forward port on your router.
  6. Set up a domain name for your router.
  7. Start the server.
  8. Check everything is running.

References

Top Articles
Latest Posts
Article information

Author: Kimberely Baumbach CPA

Last Updated:

Views: 5471

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Kimberely Baumbach CPA

Birthday: 1996-01-14

Address: 8381 Boyce Course, Imeldachester, ND 74681

Phone: +3571286597580

Job: Product Banking Analyst

Hobby: Cosplaying, Inline skating, Amateur radio, Baton twirling, Mountaineering, Flying, Archery

Introduction: My name is Kimberely Baumbach CPA, I am a gorgeous, bright, charming, encouraging, zealous, lively, good person who loves writing and wants to share my knowledge and understanding with you.