Connect with the CLI
ezvpn CLI is the client on Linux, macOS, and Windows. This guide connects it to a server, chooses what goes through the tunnel, keeps it connected, and resolves the site's private names. You need the server's endpoint ID and a key the server has authorized; setting up the other end is in Set up a server.On this page
All ezvpn guides
Install and make a key
Install ezvpn with the one-line installer for your platform (see Install ezvpn; Windows also needs
wintun.dll). The client creates a TUN device and routes, so it runs as root, or as Administrator on Windows.Make your key with flexaccess-keys and print its public entry:
flexaccess-keys generate-auth-key "alice laptop" -o client.key flexaccess-keys show-auth-key --private-key-file client.key # → ed25519-pub:… alice laptopSend the
ed25519-pub:…line to the server operator, who adds it to the server'sauthorized_keysand restarts the server. Keepclient.keyto yourself; it never leaves this machine.Get the server's endpoint ID from the operator. It is printed when the server starts, and by
ezvpn server status.
Connect
sudo ezvpn client start \
--server-node-id SERVER_ENDPOINT_ID \
--auth-key-file ./client.keyOn Windows, run it from an elevated PowerShell, on one line and without sudo:
ezvpn client start --server-node-id SERVER_ENDPOINT_ID --auth-key-file .\client.keyThe client connects, gets its VPN address from the server, and stays in the foreground until you press Ctrl+C. From a second terminal, ping the server's VPN address:
ping 10.0.0.1With no routes, this is all the client reaches: the server host itself, at its VPN address. To reach the network behind it, add routes.
Use a config file
Most command-line options can live in a TOML file instead. The annotated vpn_client.toml.example has every setting.
role = "vpnclient"
# auto_reconnect = true
# max_reconnect_attempts = 5
[auth]
auth_key_file = "/etc/ezvpn/client.key"
[network]
routes = ["192.168.1.0/24"]
# routes6 = ["fd00::/8"]
[iroh]
server_node_id = "SERVER_ENDPOINT_ID"
# relay_urls = ["https://relay1.example.com", "https://relay2.example.com"]
# exclude_direct_paths = ["100.64.0.0/10", "fd7a:115c:a1e0::/48"]sudo ezvpn client start -c vpn_client.toml
sudo ezvpn client start --default-config # vpn_client.toml in the system config directoryThe system config directory is /etc/ezvpn on Linux, /usr/local/etc/ezvpn on macOS, and %ProgramData%\ezvpn on Windows. role and server_node_id are required, and unknown keys are an error. Command-line options take precedence, and a repeatable one replaces the file's list: one --route drops the file's routes.
What goes through the tunnel
The server's own VPN address is always routed; other clients are not reachable. Everything else goes through the tunnel only if you route it, with the repeatable --route (IPv4) and --route6 (IPv6), or routes and routes6 in the config. IPv6 routes are used only if the server has IPv6. The server host then forwards that traffic (see Reach the whole site LAN).
If the server's VPN address also exists on your LAN, that one LAN address is hidden behind the tunnel for the session; the fix is a different VPN prefix on the server.
Split tunnel
Route the private prefixes you need and nothing else:
sudo ezvpn client start \
--server-node-id SERVER_ENDPOINT_ID \
--auth-key-file ./client.key \
--route 192.168.1.0/24 \
--route 172.16.0.0/12Devices in those ranges are then reached at their own addresses, as long as the server host forwards them.
An IPv6-only client through NAT64
With a NAT64 on the server's side, set the system's DNS to a DNS64 resolver (such as Google's 2001:4860:4860::6464) and route the NAT64 prefix:
[network]
routes6 = ["64:ff9b::/96"]Full tunnel (experimental)
Route everything with the default routes:
sudo ezvpn client start \
--server-node-id SERVER_ENDPOINT_ID \
--auth-key-file ./client.key \
--route 0.0.0.0/0 \
--route6 ::/0Your own LAN stays off the tunnel. Full tunnel is available in the CLI and the Windows app; the macOS, iOS, and Android apps are split-tunnel only.
Routes that overlap your network
The client refuses to start when a route you configured overlaps a network this machine is on, since routing the local subnet into the tunnel would cut off the hosts on it:
refusing to start: split-tunnel route 192.168.1.0/24 overlaps current network 192.168.1.0/24 on en0If such a network appears while connected — you arrive home with the VPN to home still up — the client exits with the same message and does not retry. A full tunnel is exempt. So a site LAN on 192.168.1.0/24 cannot be routed from another LAN numbered the same way.
Bypass routes for the tunnel's own traffic
When one of your routes contains a public address of the server or of a configured relay, the client pins that exact address (a /32 or /128) to the physical gateway for the session, so the tunnel is not routed into itself. Private addresses are never pinned. In a split tunnel this usually means no bypass routes at all; in a full tunnel the server and relay addresses are always pinned.
A pinned address is not reachable through the tunnel, so reach the server by its VPN address (10.0.0.1, fd00::1), not its public one.
Keep the tunnel off another VPN
If the server and this client are both on another VPN, such as Tailscale, ezvpn may run inside it. To keep the tunnel off it, list the overlay's networks:
[iroh]
exclude_direct_paths = ["100.64.0.0/10", "fd7a:115c:a1e0::/48"] # TailscaleOr pass --exclude-direct-path, repeatable. The tunnel then moves to another direct path or the relay. It is a preference, not a block: if no other path exists, the excluded one is kept.
Reconnect behavior
Auto-reconnect is on by default. A failed attempt — the first one included — or a lost connection is retried with backoff from 1 second up to one attempt a minute, so the client waits out a server that is down or not up yet. A permanent error — a rejected key, a bad config, a route that overlaps your network — is not retried. While it is down, ezvpn client status shows the last error and the next attempt.
| To | Config | Command line |
|---|---|---|
| Exit on the first failed attempt or drop | auto_reconnect = false | --no-auto-reconnect |
| Reconnect even if the config says not to | — | --auto-reconnect |
| Give up after N consecutive retries | max_reconnect_attempts = N | --max-reconnect-attempts N |
A dead connection is noticed after 30 seconds of silence. On reconnect, a new client address is accepted with a warning, but a changed VPN prefix or gateway makes the client exit; start it again to pick up the new settings.
Status, stop, and list
ezvpn client status # the default instance
ezvpn client status --instance work --json
ezvpn client list # every client instance on this host
sudo ezvpn client stop --instance workclient status shows the connection state, VPN address, the iroh path (direct or relay), and relay health. status and list need no root or Administrator. client stop is Linux and macOS only; on Windows, use Ctrl+C or the service manager. Background and service setups are in Run it as a service.
Several clients on one host
Several clients can run on one host — one per server, for example — as long as each has its own --instance <NAME> (letters, digits, and underscores; default if left out). The instance is a command-line option only, not a config setting.
sudo ezvpn client start -c work.toml --instance work
sudo ezvpn client start -c home.toml
ezvpn client status --instance workTo start instances at boot, see Run it as a service.
Split DNS
The CLI does not push DNS settings or match domains over the tunnel. That is by design: it does one thing, tunneling, and DNS stays with the OS. To resolve an internal zone — and its subdomains — through a resolver at the site while every other name keeps using your normal DNS, set up conditional forwarding on each client. Set it up once and leave it on: while the tunnel or the internal resolver is down, only the internal zone fails. The commands below are one example per OS; any way your system offers to forward a zone to a resolver works.
| Placeholder | Meaning |
|---|---|
<RESOLVER_IP> | The internal DNS resolver that answers for the zone. |
<INTERNAL_ZONE> | The zone to send there, for example internal.example. |
Windows
Windows uses the Name Resolution Policy Table (NRPT). In an Administrator PowerShell:
Add-DnsClientNrptRule -Namespace ".<INTERNAL_ZONE>" -NameServers "<RESOLVER_IP>"
Get-DnsClientNrptRule # verify
Resolve-DnsName test.<INTERNAL_ZONE> # test
# undo
Get-DnsClientNrptRule | ? { $_.Namespace -eq ".<INTERNAL_ZONE>" } | Remove-DnsClientNrptRule -ForceThe rule persists across reboots. Test with Resolve-DnsName, not nslookup, which ignores the NRPT.
macOS
sudo mkdir -p /etc/resolver
printf 'nameserver <RESOLVER_IP>\n' | sudo tee /etc/resolver/<INTERNAL_ZONE>Linux with systemd-resolved
For example, on the tunnel interface — the client logs its name, as in TUN device: tun0 — add the resolver and route the zone to it:
sudo resolvectl dns <TUN_IFACE> <RESOLVER_IP>
sudo resolvectl domain <TUN_IFACE> '~<INTERNAL_ZONE>'The leading ~ makes it a routing-only domain, so only that zone goes to the internal resolver. To make it permanent, put the same two settings in your network manager's config for that interface.
iOS and Android
The mobile apps are the exception, because the OS leaves no other way. The iOS app applies split DNS in the tunnel itself, with match domains in the profile; see The macOS and iOS app. Android has no per-domain DNS for VPNs at all, so the Android app forwards the match domains' queries through a forwarder inside the tunnel; see The Android app.
Custom relays
One custom relay is enough. Give the client the same relay URLs as the server and the same --relay-token and --relay-quic-addr-discovery settings as the server if it uses them:
sudo ezvpn client start -c vpn_client.toml \
--relay-url https://relay.example.comRepeat --relay-url for each additional relay if the server is configured for failover. See Relays and address lookup.
Command reference
ezvpn client start
| Option | Config setting | What it does |
|---|---|---|
-c, --config <FILE> | — | Read settings from this config file. |
--default-config | — | Read vpn_client.toml from the system config directory. |
-n, --server-node-id <ID> | [iroh] server_node_id | The server's endpoint ID. Required. |
--auth-key-file <PATH> | [auth] auth_key_file | The key file from flexaccess-keys generate-auth-key. |
--auth-key <SECRET> | — | Inline secret (ed25519-sec:…), instead of a file; visible in the process list. |
--route <CIDR> | [network] routes | An IPv4 prefix to route through the tunnel. Repeatable. |
--route6 <CIDR> | [network] routes6 | An IPv6 prefix to route through the tunnel. Repeatable. |
--relay-url <URL> | [iroh] relay_urls | A custom relay, the server's full set. Repeatable. |
--relay-token <TOKEN> | [iroh] relay_auth_token | Bearer token for the custom relays. |
--relay-quic-addr-discovery <BOOL> | [iroh] relay_quic_addr_discovery | Whether the custom relays serve QUIC address discovery, all or none. Default true. |
--exclude-direct-path <CIDR> | [iroh] exclude_direct_paths | Keep the tunnel off direct paths to server addresses in this network when another path exists. Repeatable. |
--auto-reconnect | auto_reconnect = true | Reconnect even if the config turns it off. |
--no-auto-reconnect | auto_reconnect = false | Exit on the first failed attempt or drop. |
--max-reconnect-attempts <N> | max_reconnect_attempts | Give up after N consecutive retries. Unlimited if unset. |
--instance <NAME> | — | Instance name for the lock and control endpoint. Default default. |
--daemon | — | Fork into the background (Linux and macOS); see Run it as a service. |
--congestion-control, --congestion-initial-window | — | Testing knobs; see Testing knobs. |
Other client commands
| Command | Options |
|---|---|
ezvpn client status | --instance <NAME>, --json |
ezvpn client stop | --instance <NAME>, --json. Linux and macOS. |
ezvpn client list | --json |