The best way to understand WireGuard and WG-CP is to build a network from scratch. In this tutorial, we will manually connect a cloud server and a laptop, and then see how WG-CP automates this process as your network grows.
Before we start, why do this at all? A virtual private network connects devices securely over the public internet as if they were plugged into the same local switch. This solves several common infrastructure problems:
Why WireGuard? Unlike older, heavy VPN protocols, WireGuard is the modern industry standard with universal platform support. It is incredibly simple to configure, uses state-of-the-art cryptography, handles seamless roaming without dropping connections, and delivers blazing-fast performance — especially on Linux, where it runs directly in the kernel.
First, install WireGuard on both your cloud server and your laptop. For your cloud server (Ubuntu/Debian):
For your laptop, if you are using Windows, macOS, or mobile, download the official GUI client from wireguard.com/install.
Next, generate a keypair on both machines. On your Linux server, run this command:
Note: If you are using a GUI client on your laptop, it will typically generate a keypair automatically for you when you click "Add empty tunnel".
privatekey is your secret identity (never share it!). Your publickey is how others identify you on the network.On your cloud server, create a file at /etc/wireguard/wg0.conf:
[Interface] PrivateKey = <SERVER_PRIVATE_KEY> Address = 10.0.0.1/32 ListenPort = 51820
Start the interface with: sudo wg-quick up wg0
ListenPort = 51820, we tell WireGuard to listen for incoming UDP packets on that specific port. The laptop will use the server's public IP and this port as its Endpoint to find it on the internet.Now, on your laptop, configure the connection to the server. If using Linux, create /etc/wireguard/wg0.conf. If using a GUI client, click "Add empty tunnel" and paste this configuration:
[Interface] PrivateKey = <LAPTOP_PRIVATE_KEY> Address = 10.0.0.2/32 [Peer] PublicKey = <SERVER_PUBLIC_KEY> Endpoint = <SERVER_PUBLIC_IP>:51820 AllowedIPs = 10.0.0.1/32
Important: For the ping to succeed, the server needs to know how to reply. Go back to your server's /etc/wireguard/wg0.conf and add the laptop as a peer:
[Peer] PublicKey = <LAPTOP_PUBLIC_KEY> AllowedIPs = 10.0.0.2/32
Restart the interface on the server (sudo wg-quick down wg0 && sudo wg-quick up wg0) and start the interface on your laptop (use wg-quick on Linux, or click "Activate" in the GUI client).
Now try pinging the server from your laptop: ping 10.0.0.1
AllowedIPs = 10.0.0.1/32 tells your laptop two things:10.0.0.1, encrypt it and send it to this Peer's Endpoint."10.0.0.1."WireGuard also allows you to route traffic to networks behind your peers. For example, if you want your laptop to securely access a Docker network or LAN hosted on your server:
First, ensure your server's OS allows packet routing by enabling IP forwarding. Run this on the server:
Then, simply update the laptop's config to include that subnet. For example, to access a 172.17.0.0/16 network:
[Peer] PublicKey = <SERVER_PUBLIC_KEY> Endpoint = <SERVER_PUBLIC_IP>:51820 AllowedIPs = 10.0.0.1/32, 172.17.0.0/16
Restart the laptop's interface (sudo wg-quick down wg0 && sudo wg-quick up wg0 on Linux, or toggle the connection off and on in the GUI client). Your laptop will now securely route all 172.17.x.x traffic through the server!
docker run -p 10.0.0.1:8080:80. This guarantees only VPN users can access it without exposing it to the public internet."allow-direct-routing": true to your /etc/docker/daemon.json and run sudo systemctl reload docker. (Alternatively, on a per-network basis, you can use the com.docker.network.bridge.gateway_mode_ipv4=nat-unprotected option).While point-to-point configuration is simple, scaling it introduces significant overhead. Adding multiple users or servers requires updating configuration across many devices:
[Peer] block for the new device.[Peer] blocks on all existing clients to route traffic to the new server.Managing raw wg0.conf files manually across multiple machines becomes difficult to maintain as the network grows.
WG-CP addresses this by acting as a centralized compiler for WireGuard configurations. Here is the complete API lifecycle:
First, initialize a new network namespace on the Control Plane to receive a unique Network ID.
The API will respond with your new ID, for example: {"id": "abc123def456"}
Define your entire topology in a single network.yml file and push it to the API:
Nodes no longer need to know the topology. They simply ask the API for their specific configuration based on their public key:
The API calculates the required [Peer] blocks, Endpoints, and AllowedIPs dynamically and returns a complete WireGuard configuration.
wg syncconf, updating routing rules without terminating active connections.While the API is powerful, this Control Plane provides a complete web interface to simplify managing your network. Now that you understand the underlying concepts, explore the other tabs to see how it all ties together:
network.yml with real-time validation.Head over to the Editor tab to start building your own topology!