WireGuard Cluster

Run WireGuard on several servers and manage all of them from a single panel.

How it works

The primary server is where you manage everything: instances, peers, firewall, DNS and App Gateway applications. Worker nodes run a lightweight agent that connects to the primary server, receives the configuration and applies it locally. Workers have no admin panel and no database of their own: a new node is ready in a few minutes.

1 Worker connects

The agent authenticates with its token and calls the primary server over HTTPS. Workers only make outbound connections.

2 Configuration sync

WireGuard, firewall, DNS and App Gateway settings are sent as separate sections. Only what changed is applied again.

3 Status report

Each worker reports its WireGuard status, peer traffic, services and certificates back to the primary server.

4 One view

The peer list shows on which server each peer is connected, across the whole cluster.

WireGuard cluster workers list

Cluster modes

Mirror
Every node runs every WireGuard instance with the same peers. Users choose the server when downloading the configuration or opening a VPN invite, so the same peer can connect through any node. Useful for redundancy and for servers in different regions.
Distributed
Each WireGuard instance runs on a single server, chosen in the instance settings (the primary server by default). Useful to spread instances across sites or to keep each network in its own location.

Primary server as a manager only

In mirror mode, WireGuard can be disabled on the primary server. It stops its WireGuard interfaces, is no longer offered as a server for peers and only publishes the WireGuard WebAdmin panel, while the workers keep serving every peer.

Before turning it off, make sure you can reach the panel without the VPN of the primary server.


App Gateway on worker nodes

Workers installed with the App Gateway also publish your Zero Trust applications. Each application chooses where it is served: on the primary server, on all workers or on selected workers.

Certificates are issued by the primary server and distributed to the workers, so applications published by workers must use DNS validation or self-signed certificates.


Adding a worker

01
Enable the cluster

In the cluster settings of the primary server, enable the cluster and choose the mode. The cluster uses the WireGuard status cache, which is enabled by default.

02
Create the worker

Add a worker with a name and the hostname clients use to reach it: it becomes the endpoint of the peer configurations downloaded for this server. The worker page shows its token and the installation commands.

03
Fetch the compose file on the worker server
mkdir wireguard_webadmin_node && cd wireguard_webadmin_node
wget -O docker-compose.yml \
  https://raw.githubusercontent.com/eduardogsilva/wireguard_webadmin/main/cluster_node.yml
mkdir wireguard_webadmin_node && cd wireguard_webadmin_node
wget -O docker-compose.yml \
  https://raw.githubusercontent.com/eduardogsilva/wireguard_webadmin/main/cluster_node-gateway.yml
04
Create the .env file
MASTER_SERVER_ADDRESS=https://vpn.example.com
TOKEN=token-shown-on-the-worker-page
TIMEZONE=America/Sao_Paulo
05
Start the worker
docker compose up -d

Network requirements

  • Workers must reach the primary server over HTTPS. If the App Gateway protects the panel of the primary server, add a route for /api/cluster/ with a public policy.
  • Publish the WireGuard ports (51820-51839/udp) on each worker and, with the App Gateway, ports 80 and 443.

Updating a worker

Run docker compose pull followed by docker compose up -d. To switch between VPN only and VPN and App Gateway, download the other compose file to the same directory and run docker compose up -d --remove-orphans. The worker data is kept.


Monitoring and automation

The worker page shows when the worker was last seen, its agent version, the synchronization state of each section, its services and its certificates.

Worker details page
  • Disable a worker and it shuts down its WireGuard interfaces until it is enabled again.
  • IP lock only accepts the worker from a fixed IP address.
  • API v2 lets external tools enable and disable workers and WireGuard on the primary server. The API key needs the cluster management permission.

Still one stack. The cluster is optional: a single server keeps working exactly as before, and workers can be added at any time.