> ## Documentation Index
> Fetch the complete documentation index at: https://docs.iroh.computer/llms.txt
> Use this file to discover all available pages before exploring further.

# Use your own relay

> Configure dedicated relays so your endpoints don't share infrastructure with the public network

By default, iroh endpoints use the public relays maintained by [n0.computer](https://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.

## Why use your own relay?

Running dedicated relays gives you:

* **Isolation**: your traffic isn't mixed with other developers on the shared public network
* **Performance**: relays close to your users reduce latency and improve NAT traversal success
* **Capacity**: the public relays are rate-limited; your own relays have no rate limits and capacity you control
* **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](/deployment/dedicated-infrastructure) for the deeper architecture story.

## Get a relay

You have two paths. Pick **managed** if you want a relay running today without ops work; pick **self-host** if you have infrastructure available and want full control over the deployment.

<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>

<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.
</Card>

## Configure your endpoint

Once you have one or more relay URLs, configure your endpoint to use them:

```rust theme={null}
use iroh::Endpoint;
use iroh::relay::RelayUrl;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let relay_url1: RelayUrl = "YOUR_RELAY_URL_US".parse()?;
    let relay_url2: RelayUrl = "YOUR_RELAY_URL_EU".parse()?;

    let endpoint = Endpoint::builder()
        .relay_mode(iroh::endpoint::RelayMode::Custom(vec![relay_url1, relay_url2]))
        .bind()
        .await?;

    Ok(())
}
```

## Recommended setup

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](https://cal.com/team/number-0/n0-protocol-services) to size up.

## Learn more

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](/deployment/dedicated-infrastructure).
