Set up a server
On this page
All ezvpn guides
Install ezvpn
The same ezvpn binary is the server and the CLI client. It creates a TUN device and edits routes, so it runs as root on Linux and macOS and as Administrator on Windows.
Linux and macOS
curl -sSL https://flexaccessdev.github.io/ezvpn/install.sh | sudo bashThe binary goes in /usr/local/bin. Prebuilt binaries cover Linux amd64 and arm64 and Apple Silicon macOS; on other Macs, build from source.
Windows
Run this from an elevated (Administrator) PowerShell:
irm https://flexaccessdev.github.io/ezvpn/install.ps1 | iexIt installs the binary in %ProgramData%\ezvpn and adds that directory to the machine PATH. Windows also needs wintun.dll from WinTun:
- Download and extract the WinTun zip.
- Copy
wintun/bin/amd64/wintun.dllnext toezvpn.exe(by default%ProgramData%\ezvpn\) or into a directory on the systemPATH.
Failed to create TUN device: LoadLibraryExW failed means Windows cannot find the DLL.
A specific release, or a prerelease
curl -sSL https://flexaccessdev.github.io/ezvpn/install.sh | sudo bash -s <RELEASE_TAG>
curl -sSL https://flexaccessdev.github.io/ezvpn/install.sh | sudo bash -s -- --prerelease& ([scriptblock]::Create((irm https://flexaccessdev.github.io/ezvpn/install.ps1))) <RELEASE_TAG>
& ([scriptblock]::Create((irm https://flexaccessdev.github.io/ezvpn/install.ps1))) -PreReleaseFrom source
With a Rust toolchain, from a clone of the repository:
git clone https://github.com/flexaccessdev/ezvpn
cd ezvpn
cargo install --path . # or: cargo build --releaseGive the server its identity
The server's identity is a secret key file. Its public half is the server's endpoint ID, the stable address clients dial instead of an IP and port:
ezvpn generate-server-key --output ./vpn-server.key
ezvpn show-server-id --secret-file ./vpn-server.key # print the endpoint IDKeep the key safe: a new key means a new endpoint ID, and every client has to be given it.
Write the server config
The smallest config sets an IPv4 address pool, the authorized keys, and the identity key:
role = "vpnserver"
[network]
network = "10.0.0.0/24"
[auth]
authorized_keys_file = "./authorized_keys"
[iroh]
secret_file = "./vpn-server.key"Unknown settings are an error at startup. The annotated vpn_server.toml.example has every setting.
| Setting | What it does |
|---|---|
role | Always "vpnserver". |
[network] network | The IPv4 VPN prefix clients get addresses from. The server takes the first address (10.0.0.1) unless you set server_ip. |
[network] network6 | The IPv6 VPN prefix, for dual stack or IPv6 only, for example fd00::/64. At least one of network and network6 is required. |
[network] ip6_strategy | "sequential" (default) hands out fd00::2, fd00::3, …; "node-id" derives each address from the peer's node ID (needs a /64 or wider, and no server_ip6). |
[auth] authorized_keys_file | The file of client public keys described above. |
[iroh] secret_file | The server's identity key. |
[iroh] relay_urls, relay_auth_token, relay_quic_addr_discovery | Custom relays; see Relays and address lookup. |
Relative paths are resolved against the directory the server is started from, not the config file's, so under a service manager use absolute paths.
Pick VPN prefixes that overlap neither the networks clients need to reach nor the LANs they connect from. The server caps concurrent clients at 254, and a smaller address pool can limit that further. The example IPv4 /24 has room for 253 clients after reserving the server, network, and broadcast addresses.
An IPv6-only server leaves out network:
[network]
network6 = "fd00::/64"
ip6_strategy = "node-id" # or leave out for sequentialStart the server
sudo ezvpn server start -c vpn_server.tomlOr keep the config in the system config directory as vpn_server.toml and start with --default-config:
| Platform | System config directory |
|---|---|
| Linux | /etc/ezvpn |
| macOS | /usr/local/etc/ezvpn |
| Windows | %ProgramData%\ezvpn |
On startup the server logs the command clients connect with, including its endpoint ID:
Clients connect with: ezvpn client start --server-node-id SERVER_ENDPOINT_ID --auth-key-file <KEY FILE>Give that endpoint ID to each client. From a client whose key you authorized, connect and ping the server at its VPN address:
sudo ezvpn client start \
--server-node-id SERVER_ENDPOINT_ID \
--auth-key-file ./client.key
# in a second terminal
ping 10.0.0.1The recording shows exactly this between two Linux hosts.
Loading the recording…
The server runs in the foreground until Ctrl+C or SIGTERM; only one runs per machine. To keep it running across reboots, see Run it as a service. On a Windows server, also allow the VPN prefix through Windows Firewall.
Check on the server
ezvpn server status # uptime, clients and their paths, packet counters
ezvpn server status --json
ezvpn server list # server instances on this hostNeither needs root or Administrator. For log levels and where output goes, see Logs.
Relays and address lookup
A client finds the server by endpoint ID, then iroh hole-punches a direct path when it can, and falls back to a relay when it cannot. Traffic stays end-to-end encrypted, so a relay cannot read it. With no relay settings, both ends use the public default relays and iroh's address lookup.
Custom relays
One custom relay is enough. Set relay_urls and the server uses only those relays, with public address lookup off. Configure every client with the same full list (relay_urls in its config, or --relay-url).
[iroh]
secret_file = "./vpn-server.key"
relay_urls = ["https://relay.example.com"]
# relay_auth_token = "your-shared-relay-token"
# relay_quic_addr_discovery = false- Failover requires at least two distinct relays. With a single relay, the server logs a startup warning about reduced redundancy.
relay_auth_tokenis a shared bearer token for a private relay deployment; the server, clients, and relays must all use the same one.- Set
relay_quic_addr_discovery = false, on the server and the clients, for relays behind a Cloudflare Tunnel or another HTTP-only front.
More in the shared docs: relays and address lookup, and self-hosting a relay.
Restarts and reconnects
Clients reconnect on their own, so the server can be restarted, upgraded, or started after its clients (see Reconnect behavior). After changing network or network6, restart the clients too.
Reaching more than the server host
To reach other devices on the server's network, add --route for IPv4 prefixes or --route6 for IPv6 prefixes on the client. The server host needs IP forwarding, firewall rules that allow forwarding, and a return path for the VPN prefix. ezvpn never touches the host's firewall or NAT; Reach the whole site LAN walks through it.
Upgrade both ends together
The server and clients must speak the same protocol version. Releases that share a protocol version can connect to one another.
To see which protocol each end speaks, run ezvpn --version on the server and on any CLI client. It prints the release and the protocol, as in ezvpn X.Y.Z (protocol N). The Apple, Android and Windows apps show the same number in their footer, after the core version: core X.Y.Z · protocol N. Older releases may omit the protocol number. In that case, check VPN_PROTOCOL_VERSION in src/tunnel/signaling.rs at the reported core release tag.
When an upgrade changes the protocol version:
- Upgrade the server and every client.
- Compare your configs with the current server and client examples, since unknown or removed settings are rejected at startup.
- Keep the server's identity key so clients can keep dialing the same endpoint ID. If a client still cannot connect, check its authorized key, relay settings, and the logs on both ends. As a last resort, regenerate the server's identity key. That changes the endpoint ID, so update every client profile with the new one.
Command reference
| Command | What it does |
|---|---|
ezvpn server start | Start the server from -c, --config <FILE>, or from vpn_server.toml in the system config directory with --default-config. |
ezvpn server status | Uptime, connected clients with addresses and paths, packet counters. --json. |
ezvpn server list | Server instances on this host. --json. |
ezvpn generate-server-key | -o, --output <PATH> writes a new identity key. --force overwrites an existing file; --json. |
ezvpn show-server-id | -s, --secret-file <PATH> prints the endpoint ID of a key. --json. |
Environment variables
| Variable | Effect |
|---|---|
RUST_LOG | Log filter; see Logs. |
EZVPN_RUNTIME_DIR | Moves the runtime directory; see The runtime directory. |
Testing knobs
For measuring throughput, server start and client start accept two command-line-only flags. Each governs only the local sender, so the two ends can differ.
| Flag | Effect |
|---|---|
--congestion-control <NAME> | cubic (default), bbr3, or new-reno. |
--congestion-initial-window <BYTES> | Initial congestion window, from 2660 to 8388608. Default 12000. |
Measurements are in Benchmarks, and the internals in Architecture.