Running a Reticulum Backbone at Home with Ratspeak

reticulum ratspeak lxmf lora i2p docker self-hosting homelab

Reticulum is a networking stack that doesn’t care what it runs over. TCP, I2P, a LoRa radio, a serial cable: it’s all just an interface. Addresses are hashes of public keys, everything is encrypted, and nobody hands out names or numbers.

Ratspeak is a messenger built on top of it, and the project ships its own Rust implementation of the whole stack: rsReticulum for the network and rsLXMF for messaging, with rsNode firmware for the radios on the way.

A network like that only works if people run the boring parts. So I run two of them at home:

  • a transport node (a “backbone”): a public listener that other nodes connect to, which routes packets between them.
  • a propagation node: a mailbox. If you message someone who’s offline, a propagation node holds the message until they show up.

This is the generic shape of a headless Docker deployment, not a copy-paste guide. Pick your own host and your own names.

The layout

                      ┌──────────── one network namespace ────────────┐
internet ─tcp :4242─> │  rnsd-rs  <──── shared instance ────  lxmd-rs │
                      │  (transport,                    (propagation  │
                      │   owns every interface)          node, store) │
                      └─────┬─────────────────────────────────────────┘
                            │ SAM :7656 (stack network only)
                            ▼
                          i2pd ──> I2P

Three containers:

  • rnsd-rs is the Reticulum daemon. It owns the “shared instance”: every interface, the routing, the transport identity. One TCP port is forwarded to it from the internet.
  • lxmd-rs is the propagation node. It doesn’t open any interfaces of its own. It attaches to rnsd-rs as a client and stores messages on disk.
  • i2pd is an I2P router. rnsd-rs talks to it over SAM, which gets the node a second address that doesn’t depend on an IP or a DNS record.

Build the image

There’s no official container image yet, so step one is a multi-stage Rust build of both repos: rnsd-rs and the rn*-rs tools from rsReticulum, lxmd-rs from rsLXMF. Three things to know:

  • rsLXMF builds against a sibling checkout of rsReticulum. The matching commit is in rsLXMF’s release workflow. Pin the two as a pair.
  • Bluetooth radio support is a build feature on the library crates, not the binary crate: --features rns-runtime/ble,rns-interface/ble. You also need libdbus and libudev at build time and at runtime.
  • lxmd-rs writes a file into the parent of its config directory. Mount one /data volume holding both reticulum/ and lxmf/, not two separate mounts.

Two daemons, one namespace

On Linux, the shared instance listens on an abstract Unix socket. Abstract sockets belong to a network namespace, so a second container can’t reach one unless it lives in the same namespace:

services:
  rnsd:
    image: ratspeak:<tag>
    command: ["rnsd-rs", "--config", "/data/reticulum"]
    ports:
      - 4242:4242/tcp
    volumes:
      - ./data:/data
    healthcheck:
      test: ["CMD", "rnstatus-rs", "--config", "/data/reticulum"]

  lxmd:
    image: ratspeak:<tag>
    entrypoint: ["/usr/bin/tini", "--", "/usr/local/bin/lxmd-entrypoint.sh"]
    command: ["--config", "/data/lxmf", "--rnsconfig", "/data/reticulum", "--propagation-node"]
    network_mode: service:rnsd
    depends_on:
      rnsd:
        condition: service_healthy
    volumes:
      - ./data:/data

network_mode: service:rnsd is the line that makes it work, and it comes with two things to handle.

Whoever starts first wins. If lxmd-rs comes up and finds no shared instance, it doesn’t wait. It becomes the shared instance, opens the public listener, and runs as the transport node. depends_on covers a clean docker compose up. It does nothing after a host reboot, when Docker starts containers in whatever order it likes.

The namespace goes stale. When rnsd restarts by itself (say, an image update), it gets a new network namespace. lxmd is still sitting in the old one, reconnecting forever to a socket that no longer exists. Docker shows it as running. The propagation node is offline.

So lxmd gets an entrypoint that does both jobs: wait for rnsd before starting, and bail out if rnsd disappears.

until rnstatus-rs --config "$rns_config" >/dev/null 2>&1; do sleep 2; done

lxmd-rs "$@" &

# every 30s: is the shared instance still there? three misses and we exit,
# so the restart policy brings lxmd back up beside the *current* rnsd.

rnstatus-rs only ever attaches as a client, so it’s a safe probe. After an rnsd restart, lxmd notices within about 90 seconds, exits, and comes back in the right namespace.

One more rule: pass --config to every tool, every time. The tools authenticate to the daemon with a key derived from the identity in the config directory. Leave the flag off and the tool creates a fresh config and identity in its home directory, then reports that authentication failed.

The config

A public backbone wants transport on, discovery on, and a hop limit:

[reticulum]
  enable_transport = yes
  share_instance = yes
  discover_interfaces = yes
  autoconnect_discovered_interfaces = 10

[filter]
  hop_limiter = 20

[interfaces]
  [[My Backbone]]
    type = BackboneInterface
    listen_on = 0.0.0.0
    port = 4242
    mode = gateway
    announce_cap = 0.0045
    discoverable = yes
    discovery_name = example.org
    reachable_on = rns.example.org
  • hop_limiter goes in [filter]. Under [reticulum] it’s ignored without a warning, like any other key the daemon doesn’t recognize.
  • discoverable = yes announces the interface to the network, and reachable_on is the address other nodes will dial. Set mode = gateway explicitly.
  • announce_cap is how much of the interface’s bitrate may go to relayed announces, as a percent, for each connected client. A backbone listener declares 100 Mbit/s and the default cap is 2%, so a busy transport node will never slow anything down. 0.0045 works out to about 2.5 announces a second. The cap paces, it doesn’t filter: announces wait in a queue of 4,096 per client, nearest destinations go first, and once the queue is full, new ones are dropped. Set it too low and far-away destinations never reach your clients. Watch the queue depth in rnstatus-rs -j when you tune it.
  • A discoverable node shows up on the Ratspeak map if you give it a latitude and longitude. The middle of your city is close enough.

Upstreams: let discovery do it

A backbone with no links to other backbones is just a port. You could hard-code a list of upstreams, but there’s a better option: discovery autoconnect.

Nodes announce their public interfaces, your node remembers what it hears, and autoconnect_discovered_interfaces = 10 tells it to stay connected to up to ten of them. To get started it needs a seed or two:

  [[Ratspeak Ruby]]
    type = TCPClientInterface
    target_host = 1.ratspeak.org
    target_port = 4141
    bootstrap_only = yes

A bootstrap_only interface is used to get going, dropped once enough discovered links are up, and picked back up if all of those go away. What the node discovers persists across restarts, so it’s back on the network within a minute or two. Keep the limit modest: a transport node relays a lot of announces, and ten upstreams is plenty.

I2P as a second door

The TCP listener depends on a public IP and a DNS record. I2P depends on neither. rnsd-rs supports it natively if there’s an I2P router to talk to:

  i2pd:
    image: purplei2p/i2pd:<tag>
    command:
      - --sam.address=0.0.0.0
      - --httpproxy.enabled=false
      - --socksproxy.enabled=false
  [[My I2P]]
    type = I2PInterface
    connectable = yes
    i2p_sam_host = i2pd
    mode = gateway
    discoverable = yes

rnsd-rs retries SAM until it answers, so the two containers can start in any order. rnstatus-rs shows the node’s .b32.i2p address once the tunnels are up.

Two things to know. SAM has no authentication, so its port stays on the stack’s internal network and is never published. And the address comes from a key file whose name is derived from the interface name plus the transport identity. Rename the interface and you get a new address.

The propagation node

The lxmd-rs side is a short config:

[propagation]
  enable_node = yes
  node_name = example.org
  autopeer = yes
  max_peers = 40
  static_peers = <a well-connected propagation node>
  message_storage_limit = 2000

autopeer lets it find other propagation nodes and sync with them. A static peer that’s well connected (Ratspeak publishes a list of theirs) means a message dropped at your node also lands somewhere the recipient is likely to check.

A public propagation node is busier than you’d think: tens of thousands of messages a day. Plan disk accordingly. message_storage_limit counts message bytes, not disk use, and each message is a few small files that each round up to a filesystem block. Budget roughly 13 KB per message, and expect the 30-day expiry to set the size of the store. All those small files also fill the page cache, so the container’s memory number looks much bigger than the process really is.

Adding a LoRa radio

A backbone on TCP and I2P is useful by itself. Add a LoRa radio and it also bridges the internet side to people nearby with no internet at all. A cheap board like the Heltec V3, flashed with RNode firmware (rsNode is Ratspeak’s own, still in beta), shows up to rnsd-rs as an RNodeInterface:

  [[Home Radio]]
    type = RNodeInterface
    port = ble://RNode ABCD
    frequency = 915000000
    bandwidth = 250000
    spreadingfactor = 9
    codingrate = 5
    txpower = 17

Those radio settings are for the Americas 915 MHz band. Use what’s legal where you live, and match what the radios around you use.

Over USB is the simple way: plug the board into the server, pass the serial device into the rnsd container, and point port at it.

Over Bluetooth lets you put the radio somewhere with a better view of the sky, but in a container it takes a few more steps:

  1. rnsd-rs talks to the radio through BlueZ over D-Bus. If the host doesn’t run bluetoothd, run it in a sidecar container with dbus-daemon, network_mode: host, and cap_add: [NET_ADMIN]. Bluetooth sockets only exist in the host’s network namespace. It doesn’t need to be privileged.
  2. Share the sidecar’s /run/dbus with rnsd through a host directory, and set DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket on rnsd.
  3. Give the sidecar image a user with the same UID that rnsd-rs runs as. D-Bus drops a client whose UID it can’t look up.
  4. Pair the radio by hand. rnsd-rs only uses a radio that’s already bonded. In bluetoothctl on the sidecar: agent KeyboardOnly, default-agent, pairable on, scan le. On the radio, pick Bluetooth → Connect to app to open the pairing window. Then pair <address>, type the six digits from the radio’s screen, and trust <address>.
  5. Keep /var/lib/bluetooth on persistent storage. That’s where the bond lives.
  6. In the config, target the radio by its advertised name (ble://RNode ABCD), not its MAC address.

Bluetooth range is the thing to watch. Aim for a link around -70 dBm or better; a wall or two between the adapter and the radio is enough to make it flap. And if you restart the BlueZ sidecar, restart rnsd after it.

A second board in Repeater mode extends the LoRa side: set it up in the flasher with the same radio settings and your own LXMF address as the owner, and it relays for anything in range with no computer attached.

Back up the identities

Everything above is a container you can throw away and rebuild. What you can’t rebuild is who the node is:

  • reticulum/storage/transport_identity: the transport node’s identity.
  • lxmf/identity: the propagation node’s identity. Its addresses derive from it.
  • reticulum/storage/i2p/*.i2p: the key behind the I2P address.
  • the Bluetooth bond, if you paired a radio.

They’re a few small files. Encrypt them and keep a copy somewhere that isn’t the server. Restore them into a fresh volume and the node comes back with the same addresses, and every peer that knew it still does.

That’s it

Most of the work here is glue: a source build, a shared namespace, and an entrypoint script. It’s young software, and I passed notes along to the maintainer on what would make Docker deployments easier. An official image and a reference Compose file would shrink this post a lot.

Until then, this is the shape. If you want something to connect to, mine is at rns.wright.network:4242.

← All posts