Why Rathole

The services in this lab run on machines at home, behind a consumer internet connection. Some of them need to be reachable from the public internet. The home network has no ports open to the internet and no port forwarding configured on the router, and that is not a compromise to be worked around later. It is the design.

Drafted by an AI agent (claude-opus-5) from this lab’s own runbooks, deployment log and errata. Reviewed before publication by the site owner. How this site is written →

Rathole is what makes both things true at once. It is a reverse tunnel: the machine at home dials out to a rented server, and that outbound connection is then used to carry inbound requests back the other way. Traffic arrives at the rented server, travels back down a connection the home network opened itself, and reaches the service.

Nothing at home ever accepts a connection from the internet. The relay does that, and the relay is a machine that can be rebuilt from nothing in an afternoon.

What it replaced

Cloudflare Tunnel was the obvious alternative and the one most people reading this will have used. It solves the same problem, it is free at this scale, it is operated by people who are extremely good at running it, and it requires no rented server at all.

Port forwarding was rejected earlier and more easily. It means the home router accepts connections from the internet and hands them to a machine inside the house. It also fails on any connection where the address changes or where the provider does not hand out a real public address.

There is a more basic problem with it here, and it is the kind of thing that does not appear in most self-hosting guides. A consumer internet connection is not a neutral pipe. Providers routinely block inbound traffic on the ports that matter most for hosting, and the blocking happens upstream, on their equipment, where no amount of router configuration reaches it. Mail ports are the near-universal case, and web ports are blocked often enough that plenty of people discover it only after building something that needs them.

That turns port forwarding from a design choice into a negotiation with a company that has no reason to negotiate. The usual workarounds are to pay for a business tariff, run services on non-standard ports and ask every visitor to type them, or move the service somewhere else.

The tunnel does not work around the block. It makes it irrelevant, because nothing at home is listening for inbound traffic in the first place. The connection that carries public traffic is one the home network dialed out on, and outbound connections are not what gets filtered.

A VPN for everything solves the exposure problem completely and solves the wrong problem. Some of these services need to be usable by people who are not going to install a VPN client, on devices they do not control.

Why this one

The deciding property is that nobody else holds the plaintext.

A managed tunnel service works by terminating the encrypted connection on the provider’s infrastructure, inspecting enough of the request to route it, and forwarding it on. That is not a criticism of how any particular provider behaves. It is a description of what the service is: for the provider to route traffic for a name, the provider decrypts it.

For a lab whose stated purpose is owning the data and the machines it sits on, routing family photographs and personal documents through a third party that decrypts them on the way is the one decision that would undo the point of the whole exercise.

The second reason is the one that is easy to underrate until it happens. Anything depending on a provider account is exposed to that account, and an account can be suspended, rate-limited, repriced, or lost to an automated decision with no human to appeal to. When that happens to a hobby project it is an inconvenience. When it happens to the thing your household uses to look at its own photographs, it is an outage you cannot fix at any price.

Rathole is a single binary on a machine that is already rented for other reasons. If it breaks, the cause is on a host with a login.

How it is actually used here

Two tunnels, both established, all the time.

The machine at home maintains simultaneous outbound connections to both rented gateways: the primary one that carries traffic, and the standby in another region that carries none. The standby tunnel sits idle, connected and unused.

The reason is failover. When public DNS is switched to point at the standby gateway, traffic begins flowing through the tunnel that was already up. Nothing at home reconfigures, restarts, or reconnects. The slowest part of a failover is DNS propagation, and the tunnel contributes nothing to it, because the connection it would otherwise have to establish already exists.

The tunnel client runs on a virtual machine of its own that does nothing else. It is deliberately boring: a misbehaving application cannot interfere with the tunnel, and the machine can be rebuilt from scratch quickly, because there is almost nothing on it to rebuild.

The path a request takes, and the transport underneath

A request for a service arrives at the rented gateway on the standard HTTPS port, where Caddy terminates TLS. Caddy then forwards it to a port bound only on that machine’s loopback interface, one port per published service. The tunnel server is listening there. It passes the request down the established tunnel to the client at home, which forwards it to the actual service on the internal network.

The reverse path carries the response. From the service’s point of view the request arrived from a machine on its own network, which is the point.

The tunnel itself is encrypted with the noise protocol rather than TLS. That is not the arrangement the lab’s runbook originally specified, and the change is covered in what it cost below. Noise needs no certificates: each gateway generates a keypair, and the client is given only the public half. It is a modern authenticated-encryption handshake and choosing it over TLS here is not a downgrade, it is a removal of an entire certificate-management problem from a component that does not need one.

What it cost

The documentation described a feature the shipped binary does not have. The configuration originally specified a TLS transport, which the official prebuilt release cannot do: TLS is a compile-time option and the published build does not include it. Using it would have meant building the binary from source and managing a certificate bundle for the tunnel, on top of the certificates the web server already manages.

This was found by deploying it. The general lesson is worth more than the specific fix: with a smaller project, the documentation describes what the software can do, and the release artifact decides what your copy actually does. Those are usually the same. When they differ, nothing warns you, and the gap tends to appear at the moment of first deployment.

The relay is a path inward. This is inherent to reverse tunnels and it is the honest cost of the design, so it should be said plainly rather than left implied. The tunnel exists so the rented machine can reach services at home. That is exactly what makes it useful, and it also means a compromised relay has a route into the home network, limited to whatever is published through the tunnel. The exposure is not the port the tunnel listens on. It is the direction. Anyone adopting this pattern should size the relay’s hardening against what the tunnel reaches, not against the fact that it is “just a proxy”.

You are the operator. A managed tunnel is somebody’s product with an on-call rotation. This is a small open source project with a much smaller community, which means fewer people have hit your problem before you and written it up. That is the recurring price of self-hosting and it is charged every time.

What would change the decision

As with the Caddy note, these are the agent’s reasoning from the record rather than the human’s stated position.

  • If the project stopped being maintained. A single binary in the traffic path of everything public is a small attack surface and a real dependency. An unmaintained one is a liability, and the replacement question would be about the pattern rather than the tool, since the reverse-tunnel design would survive changing what implements it.
  • If the traffic profile changed enough that a single relay stopped being adequate. The current arrangement assumes modest volume through one active relay at a time. That assumption is not tested at any real scale here and would not survive one.

What would not change it is a managed tunnel becoming cheaper or easier. The decision was never about cost or effort, so movement on either is not information.

About Rathole

Rathole is an open source reverse proxy for NAT traversal, written in Rust by the developer rapiz1 and contributors. It publishes a service running on a machine behind a firewall or a home router by having that machine maintain an outbound connection to a publicly reachable server, with no inbound port required at the private end.

It ships as a single binary with no runtime dependencies, and supports both TLS and noise as transport encryption, though which of those a given build supports depends on how it was compiled.