Getting Started
Install
Linux
curl -fsSL https://raw.githubusercontent.com/igorls/meshguard/main/install.sh | bashThis will:
- Detect your architecture (x86_64 / arm64)
- Install libsodium if needed by the selected release artifact
- Download the latest release from GitHub Releases
- Install to
/usr/local/bin/meshguard
Windows
irm https://raw.githubusercontent.com/igorls/meshguard/main/install.ps1 | iexThis will:
- Download
meshguard.exeandwintun.dllfrom the latest release - Install to
%LOCALAPPDATA%\meshguard\ - Add to your user PATH
Manual download
You can also download binaries directly from the releases page.
Building from source
Alternatively, build from source with Zig 0.16+:
| Target | Notes |
|---|---|
| Linux | Kernel or userspace mode; libsodium is an optional AVX2 accelerator on amd64 |
| macOS | Userspace mode via utun; uses std.crypto |
| FreeBSD | Userspace mode via tun(4); uses std.crypto |
| Windows | Userspace mode via Wintun; requires Administrator for meshguard up |
| Android / iOS | FFI library only; no TUN interface from the CLI |
# Debug build
zig build
# Optimized static binary
zig build -Doptimize=ReleaseFast
# Linux arm64 without libsodium
zig build -Dtarget=aarch64-linux-gnu -Doptimize=ReleaseFast -Dno-sodium=true
# macOS, FreeBSD, and Windows release targets
zig build -Dtarget=aarch64-macos -Doptimize=ReleaseFast
zig build -Dtarget=x86_64-freebsd -Doptimize=ReleaseFast
zig build -Dtarget=x86_64-windows -Doptimize=ReleaseFast
# Run test suite
zig build testThe output binary is placed at zig-out/bin/meshguard.
Quick Start
1. Generate an identity
Every meshguard node needs an Ed25519 keypair. Generate one:
meshguard keygenThis creates two files in your config directory:
- Linux:
~/.config/meshguard/(or/etc/meshguard/as root) - Windows:
%APPDATA%\meshguard\
| File | Contents |
|---|---|
identity.key | Base64-encoded Ed25519 secret key (0600) |
identity.pub | Base64-encoded Ed25519 public key |
TIP
Running keygen again will not overwrite existing keys. Use --force to regenerate:
meshguard keygen --force2. Export your public key
meshguard export > my-node.pubShare my-node.pub with every node that should trust you.
3. Trust a peer
# From a .pub file
meshguard trust /path/to/peer.pub
# From a raw base64 key
meshguard trust "dGhpcyBpcyBhIHNhbXBsZSBrZXkgZm9yIGRvYw=="
# With a human-readable label
meshguard trust /path/to/peer.pub --name validator-3The key is stored in ~/.config/meshguard/authorized_keys/<name>.pub.
4. Join the mesh
# With at least one seed peer
meshguard up --seed 1.2.3.4:51821
# Multiple seeds
meshguard up --seed 1.2.3.4:51821 --seed 5.6.7.8:51821
# With a manually announced public IP
meshguard up --seed 1.2.3.4:51821 --announce 203.0.113.42
# Kernel WireGuard mode (default is userspace)
meshguard up --seed 1.2.3.4:51821 --kernel
# Discovery/rendezvous only, no TUN interface
meshguard up --gossip-only --seed 1.2.3.4:51821meshguard will:
- Load your identity from
~/.config/meshguard/ - Derive your deterministic mesh IP (
10.99.X.Y) - Create the
mg0WireGuard interface unless--gossip-onlyis used - Run STUN to discover your public endpoint
- Begin gossiping with seed peers via the SWIM protocol
- Automatically configure WireGuard tunnels as peers are discovered
5. Stop the daemon
meshguard downWhen a userspace daemon is running, this requests a graceful shutdown through the control socket. On Linux, if no daemon control socket answers, it falls back to removing the kernel mg0 interface.
6. Check status
meshguard statusWhen a userspace daemon is running, this reports the node public key, mesh IP, and membership counts from the control socket. On Linux, if no control socket answers, it falls back to kernel mg0 status where available.
Run as a service
The installer automatically sets up a systemd service. To use it:
# Configure seed peers
sudo vi /etc/default/meshguard
# Enable and start
sudo systemctl enable meshguard
sudo systemctl start meshguard
# View logs
sudo journalctl -u meshguard -fEdit /etc/default/meshguard to set your options:
# Seed peers and flags
MESHGUARD_OPTS="--seed 1.2.3.4:51821"