# Default Relay Configurations for Iroh: Ports, Maps, and Client Settings

> Discover Iroh's default relay configurations, including the QUIC port 7842, global production relays, and staging endpoints. Learn essential client settings for seamless operation.

- Repository: [number zero/iroh](https://github.com/n0-computer/iroh)
- Tags: how-to-guide
- Published: 2026-06-18

---

**Iroh provides built-in default relay configurations including QUIC port 7842, production relays across four global regions, and staging endpoints for testing, all defined in the `iroh` and `iroh-relay` crates.**

The n0-computer/iroh repository ships with carefully chosen default relay configurations that dictate how the **Relay** server exposes endpoints and how clients discover them. These defaults cover everything from network ports and cache limits to hard-coded production hostnames for North America, Europe, and Asia-Pacific regions.

## Default Relay Server Ports and Limits

The core numeric defaults are defined in [`iroh-relay/src/defaults.rs`](https://github.com/n0-computer/iroh/blob/main/iroh-relay/src/defaults.rs). These constants control how the relay server binds to network interfaces and manages internal resources.

### Network Ports

Iroh uses the following default ports for relay operations:

- **QUIC port**: `7842` (chosen because the digits spell "QUIC" on a telephone keypad)
- **HTTP port**: `80`
- **HTTPS port**: `443`
- **Metrics port**: `9090`

These values are exported as constants like `DEFAULT_RELAY_QUIC_PORT` from the `iroh-relay` crate and re-exported in [`iroh/src/defaults.rs`](https://github.com/n0-computer/iroh/blob/main/iroh/src/defaults.rs).

### Cache and Timeout Settings

Beyond ports, the defaults include resource limits and timing parameters:

- **Key-cache capacity**: `1,048,576` entries (approximately 56 MiB)
- **Dial timeout**: 1.5 seconds
- **Happy-Eyeballs delay**: 250 milliseconds
- **DNS timeout**: 3 seconds

These settings are defined in [`iroh-relay/src/defaults.rs`](https://github.com/n0-computer/iroh/blob/main/iroh-relay/src/defaults.rs) between lines 18 and 48.

## Production Relay Map

For client connectivity, Iroh defines a production relay map spanning four global regions. These hostnames are hard-coded constants in [`iroh/src/defaults.rs`](https://github.com/n0-computer/iroh/blob/main/iroh/src/defaults.rs) and resolve to HTTPS endpoints.

The production regions include:

- **NA-East**: `use1-1.relay.n0.iroh.link.`
- **NA-West**: `usw1-1.relay.n0.iroh.link.`
- **EU**: `euc1-1.relay.n0.iroh.link.`
- **AP**: `aps1-1.relay.n0.iroh.link.`

The `default_relay_map()` function constructs a `RelayMap` containing a `RelayConfig` for each endpoint:

```rust
use iroh::defaults::prod;

let relay_map = prod::default_relay_map();

```

Each region-specific helper function (such as `default_na_east_relay()`) builds the configuration from a URL formatted as `https://{hostname}/`.

## Staging Relay Map

For integration testing, Iroh provides a reduced staging relay map that uses only the NA-East and EU regions with separate staging hostnames:

- **NA-East Staging**: `use1-1.staging-relay.n0.iroh.link.`
- **EU Staging**: `euc1-1.staging-relay.n0.iroh.link.`

Access this map via the `staging` module:

```rust
use iroh::defaults::staging;

let staging_map = staging::default_relay_map();

```

## Using Default Configurations in Code

You can access these defaults programmatically to customize client behavior or configure custom relay servers.

### Retrieve a Specific Region

To get a single relay configuration for a specific region:

```rust
use iroh::defaults::prod;

let eu_cfg = prod::default_eu_relay();
println!("EU relay URL: {}", eu_cfg.url());

```

### Override Server Defaults

When building a custom relay server, import constants from `iroh-relay`:

```rust
use iroh_relay::defaults::DEFAULT_RELAY_QUIC_PORT;

let quic_port = DEFAULT_RELAY_QUIC_PORT; // 7842

```

### Switch to Staging for Testing

For test environments, replace the production map with the staging map:

```rust
use iroh::defaults::staging;

let staging_map = staging::default_relay_map();
// Use with client API: iroh::client::Builder::with_relay_map(staging_map)

```

## Summary

- **Default ports**: QUIC uses `7842`, HTTP uses `80`, HTTPS uses `443`, and metrics use `9090`.
- **Production relays**: Four regions (NA-East, NA-West, EU, AP) with hostnames ending in `relay.n0.iroh.link.`.
- **Staging relays**: Two regions (NA-East, EU) with hostnames ending in `staging-relay.n0.iroh.link.`.
- **Key files**: [`iroh-relay/src/defaults.rs`](https://github.com/n0-computer/iroh/blob/main/iroh-relay/src/defaults.rs) defines numeric constants, while [`iroh/src/defaults.rs`](https://github.com/n0-computer/iroh/blob/main/iroh/src/defaults.rs) defines relay maps and hostnames.
- **Access patterns**: Use `prod::default_relay_map()` for production or `staging::default_relay_map()` for testing.

## Frequently Asked Questions

### What is the default QUIC port for Iroh relays?

The default QUIC port is `7842`, chosen because the digits spell "QUIC" on a telephone keypad. This constant is defined in [`iroh-relay/src/defaults.rs`](https://github.com/n0-computer/iroh/blob/main/iroh-relay/src/defaults.rs) and re-exported as `DEFAULT_RELAY_QUIC_PORT`.

### How do I switch from production to staging relays in Iroh?

Import from `iroh::defaults::staging` instead of `iroh::defaults::prod` and call `staging::default_relay_map()`. This returns a `RelayMap` containing only the NA-East and EU staging endpoints for safe integration testing.

### What is the default key-cache capacity for relay servers?

The default key-cache capacity is `1,048,576` entries, which consumes approximately 56 MiB of memory. This limit is defined in [`iroh-relay/src/defaults.rs`](https://github.com/n0-computer/iroh/blob/main/iroh-relay/src/defaults.rs) to balance performance against resource usage.

### Where are the default relay hostnames defined in the source code?

Production hostnames are defined in [`iroh/src/defaults.rs`](https://github.com/n0-computer/iroh/blob/main/iroh/src/defaults.rs) as constants like `NA_EAST_RELAY_HOSTNAME` and `EU_RELAY_HOSTNAME`. The [`iroh-relay/src/defaults.rs`](https://github.com/n0-computer/iroh/blob/main/iroh-relay/src/defaults.rs) file contains only the numeric defaults such as ports and timeouts.