Free tools / WireGuard config generator
WireGuard config generator
Create a complete WireGuard VPN setup for a Linux server: the server's wg0.conf with NAT rules and one config file per device. The key pairs are generated in your browser with the Web Crypto API, so the private keys never leave this page. Download the files or copy them, then run the setup commands on the server.
Everything runs in your browser. Nothing you type is sent to a server or stored.
Server
Clients
Keys
Generating keys in your browser...
- Enter the public IP or hostname of the server. The client configs use a placeholder until then.
# /etc/wireguard/wg0.conf
# Generated at nocthost.com/tools/wireguard-config-generator
# Needs IP forwarding: net.ipv4.ip_forward=1 (see the commands below)
[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = <server-private-key>
# NAT through eth0. Check the name of the outbound interface with: ip route show default
PostUp = iptables -I FORWARD 1 -i %i -j ACCEPT; iptables -I FORWARD 1 -o %i -j ACCEPT; iptables -t nat -I POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
[Peer]
# client1
PublicKey = <client1-public-key>
AllowedIPs = 10.8.0.2/32
[Peer]
# client2
PublicKey = <client2-public-key>
AllowedIPs = 10.8.0.3/32
[Peer]
# client3
PublicKey = <client3-public-key>
AllowedIPs = 10.8.0.4/32
# client1.conf
# Generated at nocthost.com/tools/wireguard-config-generator
[Interface]
PrivateKey = <client1-private-key>
Address = 10.8.0.2/32
DNS = 1.1.1.1
[Peer]
PublicKey = <server-public-key>
Endpoint = YOUR_SERVER_IP:51820
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 25
# client2.conf
# Generated at nocthost.com/tools/wireguard-config-generator
[Interface]
PrivateKey = <client2-private-key>
Address = 10.8.0.3/32
DNS = 1.1.1.1
[Peer]
PublicKey = <server-public-key>
Endpoint = YOUR_SERVER_IP:51820
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 25
# client3.conf
# Generated at nocthost.com/tools/wireguard-config-generator
[Interface]
PrivateKey = <client3-private-key>
Address = 10.8.0.4/32
DNS = 1.1.1.1
[Peer]
PublicKey = <server-public-key>
Endpoint = YOUR_SERVER_IP:51820
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 25
On each device, import the client file in the WireGuard app, or on Linux save it as /etc/wireguard/wg0.conf and run sudo wg-quick up wg0.
# 1. Install WireGuard (iptables is used by the PostUp NAT rules)
sudo apt update && sudo apt install -y wireguard iptables
# 2. Save the server config as /etc/wireguard/wg0.conf and lock it down
sudo nano /etc/wireguard/wg0.conf
sudo chmod 600 /etc/wireguard/wg0.conf
# 3. Turn on IP forwarding, now and after reboots
echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/99-wireguard.conf
sudo sysctl --system
# 4. Open the port and start the tunnel
sudo ufw allow 51820/udp
sudo systemctl enable --now wg-quick@wg0
sudo wg show
How to use
- Enter the public IP address or hostname of your server. Clients use it as the Endpoint.
- Check the outbound interface name on the server with ip route show default. It is often eth0, ens3 or enp1s0.
- Pick the number of clients and the tunnel type. A full tunnel sends all traffic through the VPN, a split tunnel only the VPN subnet.
- Copy the server config to /etc/wireguard/wg0.conf and run the setup commands from top to bottom.
- Import each client file in the WireGuard app on its device, connect, and check the handshake on the server with sudo wg show.
Frequently asked questions
Are the private keys safe?
They are generated by your browser's Web Crypto API and exist only in this tab. Nothing is sent to a server. Treat the downloaded files like passwords: anyone with a client config can connect to your VPN, and anyone with the server config can impersonate the server.
What if my browser cannot generate the keys?
X25519 keys need a recent version of Chrome, Firefox or Safari. On older browsers the page shows the wg genkey | tee priv | wg pubkey command. Run it once for the server and once per client on any machine with WireGuard installed, then paste the keys into the form.
Full tunnel or split tunnel?
A full tunnel (AllowedIPs = 0.0.0.0/0, ::/0) routes all traffic through the server, which is what you want for privacy on public Wi-Fi. A split tunnel only routes the VPN subnet and any networks you add, which suits reaching services on the server while the rest of your traffic goes out directly.
The tunnel connects but there is no internet. What is wrong?
Usually IP forwarding is off or the outbound interface in the PostUp rule is wrong. Check that sysctl net.ipv4.ip_forward prints 1 and that the interface name matches ip route show default. Also make sure UDP port 51820, or the port you chose, is open in the server firewall and in any cloud firewall.
Further reading
More free tools
- SSH hardening config generatorKey-only login, root off, AllowUsers, timeouts and modern ciphers as a drop-in or a full sshd_config.
- UFW firewall rules generatorOrdered ufw commands from presets or custom ports, with SSH allowed before the firewall turns on.
- Cloud-init user-data generatorA #cloud-config file for first boot: sudo user, SSH key, updates, ufw, fail2ban, auto updates and swap.
- Nginx reverse proxy config generatorAn nginx server block for a local app with Let's Encrypt HTTPS, WebSocket, redirects, gzip and rate limiting.
- Systemd service file generatorA .service unit for your app with user, environment, restart policy and optional hardening, plus the enable commands.
Need a server for your VPN? Deploy an Ubuntu VPS