guide Β· #homelab Β· 25 min
Build a Network-Wide VPN with WireGuard
Cech Tech Reviews
Access your entire home network securely from anywhere in the world. Connect to your self-hosted services, NAS, cameras, and local devices as if you were home.
- 1
Run WireGuard in Docker
docker run -d \ --name wireguard \ --restart unless-stopped \ --cap-add NET_ADMIN \ -p 51820:51820/udp \ -v ~/wireguard:/config \ -e PEERS=phone,laptop,tablet \ -e SERVERURL=your-public-ip \ -e TZ=America/Chicago # Change to your timezone (e.g., America/New_York, Europe/London, Asia/Tokyo) \ lscr.io/linuxserver/wireguard:latest
- 2
Forward port 51820 on your router
In your router settings, forward UDP port 51820 to the IP of the machine running WireGuard. This lets external connections reach the VPN server.
- 3
Get your client configs
The container generates config files and QR codes in ~/wireguard. Each peer (phone, laptop, tablet) gets its own config.
- 4
Install WireGuard on your devices
Download the WireGuard app on your phone or computer. Scan the QR code or import the config file. Toggle the connection on and you are connected to your home network.
- 5
Test from outside your network
Disconnect from Wi-Fi, use cellular data, and toggle WireGuard on. Try accessing a local IP like your NAS or Home Assistant. If it works, you are in.
