← All guides

WireGuard for home lab remote access: one open port, every service reachable

Networking · 8 min read

Smartphone on an outdoor table sending a beam of blue light toward a lit house across a valley at dusk
One tunnel home: the whole lab, reachable from anywhere.

The classic home lab frustration: everything works beautifully from the couch, and none of it works from anywhere else. The file server, the hypervisor dashboard, the service you stood up last weekend, all of it sits behind your router, unreachable from a coffee shop, a relative's house, or the airport. The tempting fix is to forward a port for each service. Resist it. Every forwarded port is a login page exposed to the entire internet, forever, including the ones you forget you opened.

WireGuard offers the grown-up version of remote access: forward exactly one UDP port, to one VPN endpoint, and authenticate with cryptographic keys instead of passwords. Once the tunnel is up, your phone or laptop behaves as if it were plugged into your home network. This guide covers the part most tutorials skip, the checks that decide whether this will work at your house at all, and the two decisions to make before you generate a single key.

Pre-flight: three checks before you install anything

1. Can anything reach you? A WireGuard server at home needs an inbound connection to arrive. Compare the WAN address shown in your router's status page with the public address a "what is my IP" site reports. If they differ, something upstream, a second router in your house, or your ISP's carrier-grade NAT, is translating addresses, and a port forward on your router alone will never be reached. Fix double NAT first (one router, or bridge mode); if the ISP is doing the translating, ask them about a public address, because no WireGuard configuration can route around it.

2. Does your address change? Most residential connections get a dynamic public IP. The tunnel endpoint is an address your clients must find, so set up dynamic DNS, a hostname that updates when your address changes, and use the hostname as the endpoint. Documented home lab setups lean on DDNS for exactly this reason; skipping it means a VPN that works until the day your ISP renumbers you.

3. Where will the server live? The WireGuard endpoint should be a machine that is always on and not the machine you reboot for fun: a small dedicated box, your router if it supports WireGuard (OpenWrt does), or a VM on a stable host. Give it a fixed address on your LAN, the router's port forward needs a target that never moves.

Split tunnel or full tunnel: decide first

On each client, one line, the peer's AllowedIPs, decides what actually travels through the tunnel. This is the decision beginners usually make by accident; make it deliberately:

Split tunnelFull tunnel
Client setting AllowedIPs lists the VPN subnet and your home LAN subnet only. AllowedIPs = 0.0.0.0/0 (plus ::/0 for IPv6) routes everything.
What happens Lab traffic goes home; everything else uses the local connection directly. All traffic exits through your home connection, as if the device never left.
Best for Everyday access to lab services, the sensible default for a home lab. Untrusted networks, and devices that should always appear to be at home.
Cost Traffic outside the tunnel is not protected by it. Your home upload speed becomes the device's speed limit for everything.

Start with a split tunnel on your personal devices. You can always keep a second, full-tunnel configuration for travel days on hostile Wi-Fi.

Setup, step by step

  1. Install WireGuard on the server. Official apps exist for Windows, macOS, iOS, and Android; on Ubuntu or Debian the tools install with sudo apt install wireguard. Installer wrappers such as PiVPN exist if you want a guided path to the same result.
  2. Generate the server's keys. WireGuard keys are base64-encoded public/private pairs: wg genkey creates a private key and wg pubkey derives the public half from it. Set umask 077 first so the private key file is not readable by everyone, and never share a private key between devices.
  3. Write the server configuration. Give the interface a tunnel address (for example the first address of a small private subnet you pick for VPN use), set ListenPort = 51820, and leave room to add a [Peer] block per device. To let clients reach the home LAN, the server also needs IPv4 forwarding enabled and a NAT masquerade rule for traffic leaving toward the LAN, this is what saves you from adding return routes to every device in the house.
  4. Forward one port. On your router, forward UDP 51820 to the server's fixed LAN address. That is the only forward. SSH, the hypervisor UI, and every other service stay un-forwarded and reachable only through the tunnel.
  5. Create the first client. Generate a separate keypair on, or for, the client device. On the server, add a peer block containing the client's public key and that client's own tunnel address as a /32 in AllowedIPs. On the client, write a config with its private key, its tunnel address, the server's public key, the endpoint (your DDNS hostname, port 51820), the AllowedIPs from your split/full decision, and PersistentKeepalive = 25 if the client sits behind NAT and needs to stay reachable, 25 seconds is the interval the official quickstart calls sensible across a wide variety of firewalls. On phones, generating a QR code from the config and scanning it in the official app is the painless import path.
  6. Bring it up and look. wg-quick automates interface bring-up from the config file. wg show displays the interface state, after a client connects, you should see its peer listed with a recent handshake and growing transfer counters.

What success looks like

Do not test from your own Wi-Fi, that proves almost nothing, because the traffic may never leave the house. Turn off Wi-Fi on your phone, switch on the tunnel, and open a service that exists only on your LAN, by its internal address. The full proof has four parts: the page loads; wg show on the server shows a handshake seconds old for that peer; a second internal service on a different machine also answers, proving LAN routing and not just reachability of the server itself; and, after you reboot the server, the tunnel comes back on its own, the reboot test that separates a configuration from a coincidence. One more property worth savoring: WireGuard is silent by design when idle, transmitting only when there is data to send, so an attacker scanning your one open port gets no reply and no confirmation that anything is listening at all.

Peer hygiene: keys, revocation, and changes

A tunnel with one shared config copied to five devices is five doors with the same key and no way to change one lock. Keep the discipline from day one: one keypair per device, named in a comment in the server config; the private key is generated on the device where possible and never travels; when a device is sold, lost, or retired, delete its peer block, that is the entire revocation procedure, and it takes under a minute. When you edit the server config, you do not have to drop everyone to apply it: applying the running configuration with wg syncconf against wg-quick strip output adds and removes peers without tearing down existing connections.

When WireGuard is the wrong tool

If your pre-flight check found carrier-grade NAT you cannot escape, a manual WireGuard server at home cannot accept inbound connections, full stop. That is the case mesh VPN tools such as Tailscale exist for: they coordinate connections through relays and NAT traversal instead of an inbound port, at the price of depending on someone else's coordination service. Likewise, if what you actually want is to publish one polished service to family members who will never install a VPN client, a VPN is the wrong-shaped answer. For one person reaching their own lab, though, WireGuard's bargain, one silent UDP port, key-based access, and the whole LAN on the other side, is very hard to beat.

FAQ

Is one open port really safe? It is a dramatically smaller exposure than a forwarded login page: the port answers only correctly authenticated packets from keys you issued, and stays silent otherwise. Smaller is not invincible, keep the host patched, but the attack surface is a single keyed door instead of every service you own.

Can I use the default port? 51820 is the conventional listen port used throughout the official examples. Using a different external port is fine as long as the forward and the client endpoint agree; it buys obscurity, not security.

My tunnel connects but nothing on the LAN answers. Why? Work the chain: handshake present (keys and endpoint are right), then check forwarding and masquerade on the server (LAN reachability lives there), then confirm the client's AllowedIPs actually includes the LAN subnet. Nine times out of ten it is one of those three.

Next: Home lab networking basics →