# AMT Relays & Multicast Backbone

Not every part of the internet is multicast-enabled. Multicast exists in "islands" — over the air with satellite/terrestrial TV/cellular broadcast, or over cables in certain network pockets. Since ISPs don't peer multicast across network boundaries, there's no way to access multicast services from outside these islands.

AMT Relays ([RFC 7450](https://datatracker.ietf.org/doc/rfc7450/)) solve this by bridging multicast traffic from SSM-enabled networks to unicast-only networks. They are the border devices that make the [TreeDN](/main/overview/control-plane/treedn-multicast.md) architecture work across the real-world internet.

Blockcast RELAY node operators assist their ISP by acquiring streams from multicast sources that can't be reached from within the ISP — using an over-the-air antenna or tunneling over unicast via AMT. This relay architecture reduces ISP backhaul utilization and improves quality to end-users.

***

## Hardware Relays: Juniper MX Routers

Juniper MX routers are the primary relay infrastructure for Blockcast — deployed inside ISP networks where they perform AMT relay functions in router silicon at line rate. Because ISPs already operate MX routers for peering and transit, Blockcast leverages existing infrastructure with a configuration change rather than new hardware deployment.

| Capability             | Specification                                                                          |
| ---------------------- | -------------------------------------------------------------------------------------- |
| Concurrent AMT tunnels | Up to **500,000** per router                                                           |
| Throughput             | Up to **1 Tbps** line-rate forwarding                                                  |
| AMT implementation     | Native in Junos firmware (no software overlay)                                         |
| Telemetry export       | **gNMI** (port 32767) for health and tunnel state                                      |
| Accounting export      | **jFlow/IPFIX** (port 4739) for per-flow CDNi billing                                  |
| Relay discovery        | **Anycast addressing** — multiple routers share a prefix for geographic load balancing |
| Target deployment      | 10,000+ routers across Tier 1 and Tier 2 ISPs                                          |

**ISP deployment model**: ISPs enable AMT relay on existing MX routers and announce an anycast prefix for relay discovery. Blockcast's `amt-astats` monitoring agent connects via gNMI and jFlow to integrate the hardware relay into the control plane — no ISP-side software deployment required. The ISP benefits from reduced peering traffic (multicast replaces N unicast streams with 1) and optional RaaS revenue sharing.

***

## Software Relays: Linux Kernel AMT (`amtr`)

For operators without Juniper hardware, Blockcast provides a containerized software relay:

* Linux kernel AMT module (`net/ipv4/amt.c`, Linux 5.12+) with full RFC 7450 state machine.
* **eBPF tunnel tracking**: XDP hooks for kernel-level per-gateway packet inspection with ring buffer events.
* Socket-based fallback tracker parsing AMT packet types in userspace.

Software relays are suitable for datacenter and cloud deployments where hardware relay access is unavailable. Performance scales with host CPU and NIC capabilities — a single 32-core server with 25GbE can support approximately 50,000 concurrent tunnels.

***

## Unified Monitoring: `amt-astats`

Both relay types are monitored through a single `amt-astats` service that provides a unified interface for the [control plane](/main/overview/control-plane/treedn-multicast.md#control-plane):

* **`/_astats` HTTP** (port 8080): Single endpoint queried by Traffic Monitor — aggregates health and tunnel state from both hardware and software relays.
* **gNMI Client**: Connects to Juniper MX hardware relays for telemetry and tunnel state.
* **jFlow Collector**: Receives IPFIX flows from Juniper MX for CDNi accounting and billing.
* **eBPF Tracker**: Inspects kernel AMT module traffic on software relays via XDP hooks.
* **Service303 gRPC** (port 9191): Orc8r health monitoring and metrics export.
* **CDNi Log Export**: Streams tunnel lifecycle events to CDN Controller via gRPC (`cdni_log.proto`).

{% @mermaid/diagram content="flowchart LR
TM\[Traffic Monitor] -->|/\_astats| ASTATS
CTRL\[Controller] -->|service303| ASTATS
ASTATS -->|CDNi logs| CTRL

```
subgraph ASTATS[amt-astats]
    direction TB
    EBPF[eBPF]
    GNMI_C[gNMI]
    JFLOW_C[jFlow]
end

EBPF ---|kernel| KERN[Linux amtr]
GNMI_C -->|gNMI| JMX[Juniper MX]
JMX -->|jFlow| JFLOW_C" %}
```

***

## DRIAD Relay Discovery (RFC 8777)

Before joining a multicast stream, receivers must discover the topologically closest AMT relay. DRIAD ([RFC 8777](https://datatracker.ietf.org/doc/rfc8777/)) provides this via DNS:

1. **Reverse the source IP octets**: `69.25.95.10` → `10.95.25.69`
2. **Build DNS query**: `10.95.25.69.amt.in-addr.arpa`
3. **Resolve via DNS** (or DNS-over-HTTPS in browsers): Returns A/AAAA records pointing to the nearest AMT relay.
4. **Select optimal relay**: Measure RTT to candidates, prefer lowest-latency relay with available capacity.
5. **Cache result**: 5-minute TTL to avoid repeated lookups.

DRIAD supports **anycast relay addresses**, enabling natural load balancing across relay deployments. When multiple relays share the same anycast prefix, DNS returns the topologically nearest.

This routing mode is also exposed through the [Traffic Router's DRIAD routing mode](/main/overview/control-plane/treedn-multicast.md#traffic-router) — used by [MAHP](/main/overview/control-plane/treedn-multicast/mahp.md) and [MoQ](/main/overview/control-plane/treedn-multicast/moq.md) receivers on RELAYs and BEACONs to discover the nearest relay for stream acquisition.

***

## AMT Tunnel Lifecycle

The AMT protocol (RFC 7450) follows a well-defined state machine for tunnel establishment:

{% @mermaid/diagram content="sequenceDiagram
participant C as Client (Gateway)
participant R as AMT Relay

```
C->>R: AMT Discovery (UDP 2268)
R->>C: AMT Relay Advertisement
C->>R: AMT Request + IGMPv3 Membership Report
R->>C: AMT Membership Query
C->>R: AMT Membership Update
Note over R: Relay joins SSM group on behalf of client
R->>C: AMT Multicast Data (encapsulated UDP)
Note over C,R: Periodic keepalives maintain tunnel" %}
```

For hardware relays (Juniper MX), the entire state machine — including packet encapsulation and IGMPv3 proxy — runs in router silicon at line rate. For software relays (`amtr`), the Linux kernel AMT module handles the state machine with optional eBPF acceleration.

***

## Standards & References

| Standard                                                       | Role in AMT/Backbone                                        |
| -------------------------------------------------------------- | ----------------------------------------------------------- |
| [RFC 7450](https://datatracker.ietf.org/doc/rfc7450/) (AMT)    | Core protocol for tunneling multicast over unicast networks |
| [RFC 8777](https://datatracker.ietf.org/doc/rfc8777/) (DRIAD)  | DNS-based AMT relay discovery                               |
| [RFC 9706](https://datatracker.ietf.org/doc/rfc9706/) (TreeDN) | Architecture that AMT relays implement                      |
| [RFC 3376](https://datatracker.ietf.org/doc/rfc3376/) (IGMPv3) | Multicast group membership used by AMT proxy                |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.blockcast.network/main/overview/control-plane/treedn-multicast/amt-relays.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
