Insights

OpenWrt WireGuard client setup in LuCI

Set up a WireGuard client in OpenWrt's LuCI, choose which traffic uses the tunnel, and verify routing and DNS from a connected device.

Illustration of keyed profile cartridge with pull tab.
On this page

In LuCI, OpenWrt's web interface, add a WireGuard interface and load the client profile issued for your router. Enable Route Allowed IPs if you want OpenWrt to add the peer's routes, and assign the interface to a firewall zone that lets local devices use it. Then test the route and Domain Name System (DNS) from a device behind the router, since a recent handshake only confirms peer contact.

In short:

  • Load the router profile. Use the WireGuard client file issued for this router.
  • Set the route scope. Match the peer's allowed destinations to the traffic you want to tunnel.
  • Test a connected device. Check both where its traffic goes and which resolver answers.

Create the client interface in LuCI

  1. Get the router's client profile. Start with a working OpenWrt gateway, access to LuCI and a client file from the administrator of the existing peer. Keep the file private because it contains the router's private key, and don't reuse another device's profile.
  2. Install WireGuard support if it's missing. If WireGuard isn't listed as an interface protocol in OpenWrt, go to LuCI → System → Software and install luci-proto-wireguard.
  3. Create the interface and load the file. In OpenWrt, go to LuCI → Network → Interfaces → Add new interface. Give it a name, select WireGuard VPN as the protocol and use Load configuration to import the client file.
  4. Check the imported settings. Confirm that the interface has the router's private key and assigned address, including the prefix length after the slash. The peer entry should have the remote peer's public key and endpoint, the address or hostname and port the router connects to.

Choose what goes through the tunnel

  1. Set the peer's Allowed IPs. These prefixes describe which destination addresses the peer should carry. For private services, use only the remote prefixes you need. For an internet exit, use 0.0.0.0/0 for Internet Protocol version 4 (IPv4) and ::/0 for version 6 (IPv6), but only for the address families the peer is meant to carry.
  2. Turn on Route Allowed IPs. Enable this on the peer if you want OpenWrt to install routes for those prefixes. If you tunnel only IPv4, check whether IPv6 still goes out directly.
  3. Allow local devices to forward through WireGuard. On a standard OpenWrt gateway that already allows forwarding from the local network to the wide area network (WAN) zone, assign the WireGuard interface to that zone. If you use custom firewall zones, check forwarding from the zone your devices actually use. If OpenWrt is just a bridged access point, this setup doesn't make it those devices’ gateway.
  4. Apply the changes. Before applying router-wide changes, make sure you're authorized to make them and can reach LuCI locally to undo them if needed. A default route doesn't prove traffic will stop when the tunnel drops.

Check which DNS resolver answers

Before testing, note which DNS resolver you expect the device to use. A resolver looks up names and returns addresses. Your public address shows where the tested connection exits, not which resolver answered its DNS queries. An imported profile or a working route doesn't tell you which resolver a particular app uses.

If a browser reports a different resolver, check the device's and browser's DNS settings before changing WireGuard keys or routes. If a private service works by address but not by name, check whether the device uses a resolver that can answer for that private name.

Test from a device behind the router

  1. Generate traffic and check the handshake. On a device using OpenWrt as its gateway, open an internet page or try to reach the private service you intend to use. In OpenWrt, go to LuCI → Status → WireGuard and look for a recent handshake with the peer. If there isn't one, check that the endpoint is reachable and that each side has the other's correct public key.
  2. For an internet exit, check public addresses and DNS. From the connected device, open a browser test such as ipleak.net. Compare the public IPv4 address and any available IPv6 address with the expected exit for each family. Then compare the reported DNS resolver with the one you expect. If IPv6 should use the tunnel, a matching IPv4 result alone isn't enough.
  3. For private subnets, test by address and then by name. Try a known private service at its address, then reach the same service by its private name. Reaching it by address checks the path to the service. Reaching it by name checks that the device can also resolve that name. Your public address can stay the same in this setup.

You're done when LuCI shows a recent handshake and the connected device reaches the expected exit or private service with the expected DNS result. If the handshake is recent but traffic takes the wrong path, check the device's gateway, the installed peer routes and firewall forwarding. The results apply to the device and traffic you tested, not to every app on the network.

Where doxx.net fits. If you only need to connect a Windows or Linux device, you can use a standard WireGuard client with your doxx.net configuration to join the private network. For that device-level option, you can get started with doxx.net without changing your OpenWrt router.

Ask an AI assistant

Share this article

Private Everywhere

Stop giving the internet everything

Keep your browsing, messages, files, and agents private.