To set up a VPN on a router, first decide which direction you need. A VPN client on the router sends every connected device's traffic through a VPN provider, and a VPN server on the router lets you connect back to your home network from outside.
The two jobs use different menus, and many consumer routers only support the second one. Check which your router offers before you sign up for anything. The steps below use OpenWrt for the client case, because its menus are documented in detail by VPN providers, and then cover what Netgear and ASUS document for the server case.
Client or server: which one do you want?
The word "VPN" covers two different setups that happen to live in the same router menu. Pick by what you want to achieve.
| Goal | Router role | What you need |
|---|---|---|
| Send all devices at home through a VPN provider, including a TV or console that can't run a VPN app | VPN client | A router whose firmware has a VPN client (for example OpenWrt), and a provider config file |
| Reach your home network, files or cameras from a hotel or phone | VPN server | A router with a VPN server feature, a way to find your home IP address, and a client app on each remote device |
If you are not sure how a tunnel actually carries traffic, how a VPN works explains the virtual adapter and encapsulation that both setups rely on.
Check that your router can do it
Start in your router's admin pages and look for a menu called VPN, VPN Client, VPN Service or similar. Some stock firmware only exposes a server. Netgear, for example, documents a VPN feature on its routers that is a server for connecting to your own network: its support article walks through turning on "VPN Service" and downloading configuration files for the computers that will connect. It does not describe a client for a commercial VPN provider.
If the stock firmware has no client, you have three practical options:
- Install third-party firmware such as OpenWrt, if your exact router model is supported. Check the model against the OpenWrt hardware table first, because flashing an unsupported or wrong-revision image can leave the router unusable.
- Buy a router that lists a VPN client in its specifications.
- Skip the router and run the VPN app on each device instead.
Also note the performance trade-off. All encryption now happens on the router's processor, so the speed you get through the tunnel depends on the model and the protocol. Test your speed with and without the tunnel after setup rather than assuming it matches your plan.
How to set up a VPN client on an OpenWrt router
This follows Proton VPN's documented WireGuard setup for OpenWrt, which uses the LuCI web interface. Other providers use the same general steps with different names and DNS addresses. Menu wording can differ between OpenWrt releases, so treat the paths as a guide.
- Get a WireGuard configuration file from your provider. In Proton's case, this is the WireGuard configuration under the account's Downloads page, with the platform set to Router. Keep the file private: it contains your private key.
- Install the WireGuard LuCI package. Go to
System > Software > Actions > Update lists, filter for "WireGuard", and installluci-proto-wireguard(Proton says to useluci-app-wireguardif the first is not listed). Then reboot fromSystem > Reboot. - Create the interface. Go to
Network > Interfaces > Add new interface, give it a name, set the protocol to WireGuard VPN and click Create interface. - Import the configuration. Under Import configuration, choose Load configuration, paste the contents of the file and click Import settings.
- Route all traffic through the peer. On the interface's Peers tab, edit the imported peer and make sure Route Allowed IPs is checked. Save the interface, then Save & Apply.
After step 5, internet access through the router stops until the firewall is configured, according to Proton's guide. That is expected, so do not undo the interface.
Create the firewall zone
Go to Network > Firewall > Zones > Add and use these values from Proton's guide:
| Setting | Value |
|---|---|
| Name | vpn |
| Input | Reject |
| Output | Accept |
| Forward | Reject |
| Masquerading | Enabled |
| Covered networks | The WireGuard interface you created |
| Allow forward from source zones | lan |
Then edit the lan zone: enable MSS clamping, and under "Allow forward to destination zones" deselect everything except vpn. Removing the wan forwarding means LAN devices have no path to the internet except through the tunnel. Proton's guide does not call this a kill switch and does not say what happens if the tunnel drops, so test it yourself: disable the interface and confirm that a device on your network can no longer load a web page.
Set DNS
Go to Network > Interfaces > wan > Edit > Advanced Settings. Deselect "Use DNS servers advertised by peer", enter the DNS server address your provider gives you for the tunnel (Proton's guide uses 10.2.0.1), click the plus button, and Save & Apply. Without this step, name lookups can keep going to your ISP's resolver.
What the WireGuard fields mean
The imported file is a plain-text WireGuard configuration. You can read it before you paste it, and it helps to know what you are loading. The WireGuard quickstart describes the main settings of a peer on the command line:
private-keyis your side's key, base64 encoded. It must stay on the router.endpointis the address and port of the provider's server, for example203.0.113.10:51820(a documentation address).allowed-ipslists the addresses that may be routed to that peer. A VPN provider setup normally allows all addresses, so everything goes through the tunnel.PersistentKeepaliveis off by default (0). The quickstart suggests 25 seconds as a sensible interval for getting through NAT or a firewall.
In a config file these appear as [Interface] and [Peer] sections. For a client behind your home router, a keepalive is often useful, because your router sits behind NAT at your ISP.
How to set up a VPN server on a Netgear router
Netgear's support article covers the server case, and as of its current text it is OpenVPN only: "only OpenVPN version 2.7.1 or earlier work with NETGEAR routers". The documented steps for a Windows computer are:
- Enable Dynamic DNS first, because the VPN feature needs it so remote devices can find your home address.
- Go to
ADVANCED > Advanced Setup > VPN Service, tick Enable VPN Service and click Apply. - Click For Windows to download the configuration files.
- Install OpenVPN on the computer, unzip the files and copy them to the OpenVPN client's
configfolder. - Rename the TAP-Windows Adapter connection to
NETGEAR-VPN. The article warns that the tunnel fails without this change.
The article's list of applicable products includes several Nighthawk models. Menu names and supported versions change with firmware, so check your own model's page.
Setting up a VPN server on an ASUS router
ASUS's support article is about hosting a VPN server on a router that sits behind another router. In that case you must forward the VPN's ports on the first router. The ports it lists are:
| Protocol | Ports to forward |
|---|---|
| PPTP | TCP 1723, plus IP protocol 47 (GRE) |
| OpenVPN | UDP 1194 |
| IPSec | UDP 500 and UDP 4500 |
It also warns that if the first router's WAN type is PPTP, L2TP or PPPoE, you may have VPN connection problems. The article does not cover VPN client setup, so for that, use the manual for your exact ASUS model.
Test that the VPN is actually working
For a client setup, open a site that shows your public IP address from a device behind the router. It should show your provider's server address, not your ISP's. Then run a DNS leak test, which is the second check Proton's guide recommends. If the address is your ISP's, the traffic is not going through the tunnel, so recheck the Route Allowed IPs box and the firewall forwarding rules. For a server setup, test from outside your network, for example a phone on mobile data, because a test from inside your own network proves nothing about the forwarded ports.
If it still fails
- No internet after Save & Apply. The firewall zone or the LAN forwarding is missing. Proton's guide says internet stops until the firewall is configured.
- Tunnel won't connect. Check that the router's clock is correct and that the endpoint address and port in the file match your provider's. Check the provider's limit on simultaneous devices, since the router counts as one.
- Remote server connection fails. Your home IP address may have changed, which is why Netgear requires Dynamic DNS, or the ports are blocked by an upstream router, as in the ASUS case above.
- Pages load slowly or partly. A packet-size problem can cause this. MSS clamping on the LAN zone, which the OpenWrt steps above enable, is the documented guard against it.
Frequently asked questions
- Can any router run a VPN?
- No. The router's firmware has to include a VPN client or server feature. Many consumer routers only offer a VPN server for reaching your home network remotely, not a client that sends your traffic to a VPN provider. Check your model's menus or manual, or install third-party firmware such as OpenWrt if your model is supported.
- What is the difference between a VPN client and a VPN server on a router?
- A VPN client on the router connects out to a VPN provider and sends the traffic of every device behind the router through that tunnel. A VPN server on the router accepts incoming connections from your own phone or laptop, so you can reach your home network while you are away.
- Do I still need the VPN app on my phone or laptop?
- Not for devices behind a router that runs a VPN client, because their traffic already goes through the tunnel while they are on that network. When you leave the house, those devices are no longer covered, so you still need an app or a connection to your home router's VPN server.
- Which VPN protocol should I pick on a router?
- Use whichever protocol both your router firmware and your provider support. WireGuard uses a short configuration file and is available on OpenWrt, while OpenVPN is the protocol Netgear documents for its router VPN service. If your router offers a choice, WireGuard is the simpler one to configure by hand.