| title | Use your own relay |
|---|---|
| description | Configure dedicated relays so your endpoints don't share infrastructure with the public network |
import RelayPresetConfig from '/snippets/relay-preset-config.mdx';
By default, iroh endpoints use the public relays maintained by n0.computer to facilitate connections when direct peer-to-peer links aren't possible. The public relays are great for development and testing, but production deployments should run their own.
Once you have one or more relay URLs, configure your endpoint to use them:
Relays you self-host outside of Iroh Services are configured directly with RelayMode::Custom; see Dedicated Infrastructure.
Running dedicated relays gives you:
- Isolation: your traffic isn't mixed with other applications
- Performance: relays close to your users reduce latency and improve NAT traversal success
- Capacity: the shared public infrastructure is rate-limited
- Redundancy: distribute relays across regions or cloud providers for failover
- Compliance: keep relayed traffic inside your own network or jurisdiction
Iroh's relay architecture is uniquely suited to multi-relay deployments because relays are stateless. Clients automatically fail over between relays in your list, so adding capacity or surviving an outage is just a matter of running more relay processes. See Dedicated Infrastructure for the deeper architecture story.
You have two paths. Pick managed if you want a relay running today. But you're never locked in! You can always self-host later if you want.
<Card title="Deploy a managed relay" icon="server" href="https://services.iroh.computer?utm_source=docs&utm_content=add-a-relay"
Sign up for Iroh Services and spin up a managed relay for your project in minutes.
<Card title="Self-host a relay" icon="wrench" href="https://github.com/n0-computer/iroh/tree/main/iroh-relay"
Run the iroh-relay binary on a server with a public IP and DNS name. Automatic TLS via ACME is built in.
For production, run at least two relays in different geographic regions, for example one in North America and one in Europe. iroh clients try multiple relays automatically, so if one becomes unreachable they'll seamlessly fall back to another.
Each relay handles up to 60,000 concurrent connections. For larger deployments, run multiple relays per region or contact us to size up.
For the full architecture story (why stateless relays make uptime management easier, how multi-cloud resilience works, and managed relay deployment steps) see Dedicated Infrastructure.