WireGuard runs natively on OpenWrt, which turns a single router into either a whole-network VPN gateway or a remote-access server for your home. This guide sets up WireGuard on an OpenWrt router end to end in 2026: installing the package, then two real configurations - OpenWrt as a client (route the entire LAN out through a remote peer) and OpenWrt as a server (reach your home network from anywhere).
No server yet? See the options after the steps
What you need before you start
- A router running OpenWrt with enough free flash and RAM for the WireGuard packages. Very low-flash devices (4/32 MB) may not have room - check your device's free storage first.
- A WireGuard peer to connect to. For client mode this is the remote server you route through; for server mode it is the remote devices that will connect back. A self-hosted server on a Contabo VPS makes a reliable peer you fully control. A Contabo Cloud VPS 4 is listed from €5.50/month on contabo.com (list price checked 17 October 2026, 24-month term, excl. VAT); affiliate link, your price does not change.
- The keys and endpoint for the other side: in client mode, the server's public key and its reachable
host:port. Each peer gets its own key pair - reusing one key across devices breaks the handshake.
If the protocol itself is new to you, our what is WireGuard explainer covers the cryptography and why it is faster than OpenVPN.
Step 1 - Install WireGuard support
WireGuard is not always preinstalled, so add the packages. Over SSH:
opkg update
opkg install luci-proto-wireguard wireguard-tools
luci-proto-wireguard adds the WireGuard protocol to the LuCI web interface, and wireguard-tools gives you the wg command for generating keys and inspecting tunnels. You can also install these from System > Software in LuCI if you prefer the UI. After installing, refresh LuCI so the new protocol appears.
Step 2 - Generate keys
Each end of a WireGuard tunnel has a private/public key pair. On OpenWrt, generate one with wireguard-tools:
wg genkey | tee privatekey | wg pubkey > publickey
Keep the private key on this router and share only the public key with the other peer. If OpenWrt is the client, you will also need the server's public key; if OpenWrt is the server, you collect the public key of each client that will connect.
Quick answer: OpenWrt can run WireGuard natively. Install the luci-proto-wireguard package, then create a WireGuard interface under Network > Interfaces in LuCI. Run OpenWrt as a client to send all LAN traffic through a remote VPN peer, or as a server to give remote devices access to your home network. The hard part is rarely the keys - it is the firewall zone and routing, so most "no handshake" or "no internet" problems are solved there.

Before you configure the router: if your OpenWrt box sits behind your ISP's router or on a CGNAT line, no forward will reach it. The WireGuard port checker compares the router's WAN address with your public IP and writes the OpenWrt firewall rule for your port.
On a CGNAT line, keep OpenWrt as the client and put the server on a VPS with its own public IPv4, for example a HostPapa Unmanaged VPS Lite (affiliate link, 2.95 $ a month on a 3-year term, then the regular rate) or a Contabo Cloud VPS (affiliate link), from 5.50 € a month on a 24-month term as read on 17 October 2026: the router dials out, which CGNAT does not block, and the VPS becomes the meeting point for your remote devices. If you would rather have a US host with a 30-day money-back guarantee, Ultahost VPS Basic is 5.52 $ a month on a 24-month term (1 GB RAM, dedicated IPv4, read on 21 October 2026), enough for a WireGuard server for a few devices. HostPapa's Lite plan is the smallest one here: 1 core, 1 GB RAM, 25 GB NVMe and 4 TB transfer, unmanaged (root SSH on Ubuntu or Debian, no control panel, you install WireGuard yourself), enough for a WireGuard server for a few devices, 30-day money-back guarantee, read on 28 October 2026.
Still choosing the server? Our cheapest-VPS ranking for WireGuard compares what each provider really bills for a usable endpoint.
Case A - OpenWrt as a WireGuard client (route the whole LAN out)
In client mode, every device on your LAN leaves through the remote peer - a full-tunnel VPN for the entire home network.
- Create the interface. In LuCI go to Network > Interfaces > Add new interface, name it (e.g.
wg0), and choose WireGuard VPN as the protocol. - Fill the interface. Set the Private Key (this router's key) and the IP address this router takes inside the tunnel (the address your server assigned, e.g.
10.0.0.2/24). - Add the peer. Under the Peers tab add the server: its Public Key, Endpoint host and Endpoint port, Allowed IPs =
0.0.0.0/0(and::/0for IPv6) for a full tunnel, and Persistent Keepalive =25so the path survives NAT. - Firewall zone. Assign the
wg0interface to a firewall zone. The simplest working setup is to put it in the wan zone (or a dedicated zone that is allowed to forward from lan and has masquerading enabled), so LAN traffic is NAT'd out through the tunnel. - DNS. Set the tunnel's DNS to your server or a trusted resolver so lookups do not leak back to your ISP.
When it works, every LAN device's public IP becomes the server's IP.
Need the server side too? Our free WireGuard config generator writes a server config and a client config in your browser; the client file's PrivateKey, Address, PublicKey, PresharedKey and Endpoint map one-to-one onto the LuCI interface and peer fields above. The generator is free with no account, up to 250 devices, and its ZIP export holds every client .conf and its QR code as a PNG, handy to set up a whole office or family in one go.
Generate your WireGuard configs here
Type your server address, choose the number of devices, then scan each QR code from the app.
All keys are generated in your browser (Curve25519 / X25519). Nothing is sent to our servers - your config stays 100% private.
Public IPv4 or domain of the machine that will run WireGuard. No server yet? Leave it empty and add it later.
Free, no account: up to 250 clients, each .conf with its QR code, and one ZIP with every file.
Everything the device sends to the internet goes through your server.
Advanced settingsTunnel subnet, DNS, site-to-site LANs. The defaults work for most setups.
Optional. Enter the LAN subnet behind the server and/or behind a client that acts as a site gateway (a router, a Raspberry Pi, a NAS). The generator adds each LAN to the server's AllowedIPs, gives every peer the routes to the other LANs, and writes the forwarding rules on the gateways. Leave a field empty for a normal client.
What you download
wg0.conf
for the server
client1.conf
one per device
QR (sample)
for the phone app
Illustration only: the lines and the QR code are fictional, no real key. Your real files are generated in your browser when you click.
Case B - OpenWrt as a WireGuard server (remote access to your home network)
In server mode, OpenWrt listens for incoming connections so your phone or laptop can reach the home LAN from anywhere.
- Create the interface the same way (Network > Interfaces, protocol WireGuard VPN), give the router its Private Key and a VPN-side IP address (e.g.
10.0.0.1/24), and set a Listen Port (commonly51820). - Open / forward the UDP port. Allow the chosen UDP port inbound in the firewall. If OpenWrt is behind another modem/router, forward that UDP port to the OpenWrt box; if your ISP uses CGNAT, inbound may not be reachable at all - see dynamic DNS for self-hosting. Our free WireGuard port checker tells you whether a forward can work on your line (it compares the WAN address with your public IP to spot CGNAT) and writes the matching OpenWrt firewall rule.
- Add each client as a peer. For every remote device add a Peer with its Public Key and Allowed IPs set to that client's tunnel IP (e.g.
10.0.0.2/32). To let clients reach the whole home LAN, include your LAN subnet (e.g.192.168.1.0/24) in the client's config and allow forwarding. - Firewall forwarding. Put the WireGuard interface in a zone that may forward to lan, so connected clients can reach local devices.
Anatomy of the config
OpenWrt stores this in /etc/config/network, but the shape mirrors a standard WireGuard config. Here it is with explicit placeholders - never paste real keys from a guide; each device generates its own:
[Interface]
PrivateKey = <this-router-private-key>
Address = 10.0.0.1/24
ListenPort = 51820
[Peer]
PublicKey = <other-peer-public-key>
Endpoint = <peer-host-or-ip>:51820
AllowedIPs = 10.0.0.2/32
PersistentKeepalive = 25
PrivateKey- this router's secret key, kept local.Address- the router's IP inside the tunnel.ListenPort- only needed when OpenWrt is the server.PublicKey- the other peer's public key (the server's, in client mode).Endpoint- the reachablehost:portof the peer (only the client side needs this for an outbound tunnel).AllowedIPs- what routes through:0.0.0.0/0for a full tunnel (client), or a specific tunnel/LAN subnet (server).PersistentKeepalive = 25- keeps the path alive behind NAT.
Troubleshooting on OpenWrt
- No handshake: most often a firewall issue - the WireGuard interface is not in a zone, or the zone cannot forward. Check the Endpoint host/port and that the server's UDP port is open; confirm the public keys match; remember a home server behind CGNAT may be unreachable inbound. More in our handshake troubleshooting guide.
- Connected but no internet (client mode): the WireGuard zone needs masquerading, and lan → wg forwarding must be allowed; otherwise NAT'd LAN traffic has no path out.
- MTU: WireGuard defaults to 1420; on a PPPoE WAN, 1412 is a common working value. If some sites stall, lower the interface MTU step by step - see our WireGuard MTU fix guide.
- DNS doesn't apply: set the DNS on the WireGuard interface (or push it via your firewall/DHCP) so LAN clients use the tunnel's resolver instead of the ISP's.
- Kill-switch: route the whole LAN only through the WireGuard zone and block lan → wan directly, so traffic stops if the tunnel drops instead of leaking out the normal WAN.
Client vs server at a glance
| OpenWrt as client | OpenWrt as server | |
|---|---|---|
| Goal | Route the whole LAN out through a remote peer | Let remote devices reach your home LAN |
| AllowedIPs | 0.0.0.0/0 (full tunnel) | client tunnel IP + LAN subnet |
| Listen port | Not required | Required (e.g. 51820, opened inbound) |
| Firewall | wg zone → wan, masquerade, lan→wg forward | wg zone may forward to lan |
| Endpoint | Points at the remote server | Clients point at the OpenWrt router |
A VPN changes your IP. It does not change your browser.
A tunnel replaces the address a service sees. It changes nothing about what your browser announces on its own - fonts, screen, time zone, graphics stack - and that combination is often stable enough to recognise you across sessions, tunnel or no tunnel.
Measure your own browser fingerprint - passive, no questions, no account, no email.
The bottom line
OpenWrt makes WireGuard a router-level feature: install luci-proto-wireguard, create the interface in Network > Interfaces, and pick client (whole-LAN VPN) or server (remote access). Almost every failure is the firewall zone or routing, not the keys. For the peer at the other end, a Contabo VPS at €5.50/month runs a personal WireGuard server your OpenWrt router can dial out to, with no shared keys and full control.
Editorial guide based on the documented behaviour of OpenWrt's WireGuard support (luci-proto-wireguard / LuCI). Exact menus vary slightly by OpenWrt version. Commercial links carry the rel="sponsored nofollow" attribute; an affiliate commission may apply at no extra cost to you.
Affiliate link
★ Nuremberg GDPR datacenter · ✓ Dedicated IPv4 included · 200 Mbit/s port
Self-host your VPN on your own VPS → ContaboCloud VPS 4 · 5,50 €/mo · Card or PayPal · orders from outside the EU accepted→Price checked 17 Oct 2026, 24-month term


