Run your own relay

A relay is a small server that Mirall reaches by its key. Running one yourself is how you know who operates the machine your blocked connections pass through.

What the machine needs

  • A real public IP address, and inbound UDP on the relay's port — a small VPS, or a home server behind a router you can port-forward.
  • The port forwarded straight through, if there is a router in front. 49737 outside has to reach 49737 on the relay. A remapped external port cannot work: reachability is decided by other nodes sending unsolicited packets to the port the relay is bound to.
  • Not behind CGNAT. Most mobile networks and many fibre ISPs put you there, and the relay itself then cannot be reached.
  • Not on the same network as the people using it. That is the network they are trying to get out of.
  • Bandwidth. Every relayed byte arrives and leaves again, so bandwidth, not CPU, is what a relay costs.

Peers find a relay by its key, never by its address. Nothing you hand out carries a host or a port, so you can move the relay or change its port and every key and invite already issued keeps working.

Pick one to run

Four ways, depending on the machine you have. Each name below opens its repository on GitHub, where the install instructions, the container image and the source live.

  • mirall-relay-startos — the least work by far, if you run a StartOS home server. Add the registry.zsapping.net registry, install Mirall Relay from the marketplace, and the package handles the container, the data volume and the operator pages. It derives the identity during install, so the public key exists before the relay has even started. You still have to forward UDP 49737.
  • mirall-relay-lite — one container, one key, nothing else. The key it prints on first boot is the entire configuration. Open to anyone holding it, with an allowlist of peer keys if you want to fence it to a fixed group. This is the one to reach for on a plain VPS.
  • mirall-relay — the full relay, for a team or a company. It adds invites you mint and revoke per person, an operator status page that tells you whether the world can actually reach you, per-connection and per-key caps, bans, and Prometheus metrics. Its container image is published too, and it is what the StartOS package builds on.
  • blind-relay-service — Holepunch's own, packaged for their fleet; on a machine that already runs Pear, pear blind-relay start does the same job. Both build on the same blind-relay and hyperdht libraries as the Mirall relays above, and neither offers an allowlist or a packaged container.

The shortest path, on a Linux host

mirall-relay-lite, from its published image. Nothing is built and no checkout is needed. If the host has no Docker yet, curl -fsSL https://get.docker.com | sh covers most Linux distributions and docs.docker.com/engine/install covers the rest.

docker run -d --name mirall-relay-lite --restart unless-stopped \
  --network host \
  -v mirall-relay-data:/data \
  ghcr.io/ok/mirall-relay-lite:latest

docker logs mirall-relay-lite

The log prints the relay's public key on first boot — 52 characters, created for you, with no keygen step. --network host is the right choice on Linux; the named volume is what keeps that key the same across restarts.

Paste the key into Mirall on each device under Settings → Network → Relay → Add relay. Both Mirall relays also ship a docker-compose.yml doing exactly the same thing, and their READMEs carry every setting, how to pin a version or a digest, and how to back the identity up.

Check that it works

Test in Mirall, on the relay's row, is the check that matters: it dials the relay and waits for it to answer as a relay. Reachable means the thing is genuinely usable by the people you hand the key to.

A relay on a laptop will start, print a key, and look perfectly healthy while being useless — nothing behind a home router or a Docker Desktop VM can be reached by a peer. mirall-relay-lite has no reachability check of its own, so nothing in its log will tell you; Test will. mirall-relay does check, and says so on its status page at localhost:9200.

Open or private

An open relay admits anyone holding its key, and that key can be passed on. Mirall offers an open relay you have configured to the people you connect with, so someone with no relay of their own is carried by yours without configuring anything.

A private relay admits only the people you have minted an invite for, and Mirall never offers it to anyone else: a stranger who adopted the key would only be refused, and a refusal looks exactly like the relay being down. A private relay helps its own members reach each other, so enrol both ends of any pair that needs it.

Back up the relay's identity — the seed its public key is derived from. Lose it and the relay comes back as a stranger, while everyone who configured it is left pointing at a key nobody answers on.

Configure it on both sides when you can

One side supplying a relay is enough for a connection to be made, but the recovery is asymmetric: if the side without a relay is the one behind the restrictive network, the connection only comes back after the other side's direct attempt has timed out. Both sides configured means neither has to wait for that.

Mirall news

Know when the next release ships.

An email when a new version of Mirall is out, and now and then an offer. Nothing else, and never from anyone but us.

  • Release notes, in plain words
  • One click to unsubscribe

By subscribing you agree to receive release news and occasional offers from Mirall by email, sent with CleverReach. We send a confirmation link first, and you can unsubscribe at any time. See the Privacy Policy.