Keenrig

Servers behind CGNAT: the Keenrig Cloud tunnel

Home connections behind carrier-grade NAT (CGNAT) cannot forward ports, so nothing on the internet can reach the server directly. If the server is paired with Keenrig Cloud, the installer publishes its admin panel through a tunnel instead.

When the tunnel is used

Only when both are true: the server is paired with Keenrig Cloud, and Keenrig Cloud cannot reach it on port 80 or 443 at its public address. A server that can be reached directly never gets a tunnel, and neither does a server that is not paired.

You do not switch it on yourself. After pairing, the installer asks Keenrig Cloud whether the machine can be reached, and sets up the tunnel only if it cannot.

Set it up

  • In Keenrig Console, add an environment and, at the server step, pick “I have my own machine”. The Console shows a one-time join token.
  • Run the command the Console shows on the server. On a server that is already installed it only pairs: nothing is reinstalled, and apps and data stay.
  • If the machine cannot be reached, the installer says so, sets up the tunnel and prints the admin address to use.

Pasting the token into the admin panel’s Cloud Link page pairs the server too, but does not set up the tunnel. Behind CGNAT, run the command instead.

How it works

The tunnel is a Cloudflare quick tunnel, run by the cloudflared program on your server as the keenrig-tunnel service. It only makes outgoing connections; nothing listens on a public port.

Visitors open the admin address that the installer and the Console show, under keenrig.app. Traffic goes browser → Keenrig Cloud → Cloudflare → your server. HTTPS ends at Keenrig Cloud and again at Cloudflare, so both handle the traffic unencrypted on its way through.

The server reports its tunnel address to Keenrig Cloud every minute. If Keenrig Cloud has not heard from it for more than 5 minutes, visitors see a “not reachable right now” page instead.

Limits today

  • The tunnel carries the admin panel. Installed apps are not published through it yet: for apps, the server needs ports 80 and 443 reachable from the internet.
  • A server behind CGNAT cannot get certificates for your own domain, because Let’s Encrypt has to reach it.
  • There is no switch to force the tunnel on or off.
  • Networks that block Cloudflare quick tunnels (trycloudflare.com) cannot use it.

Check on it

The tunnel restarts on its own if it stops. To see what it is doing:

sudo journalctl -u keenrig-tunnel -n 50

Without a tunnel

The simplest fix for CGNAT is a machine with a public IP address, such as a small VPS, or an internet plan where your provider lets you forward ports 80 and 443. Then the server needs no tunnel, and every app gets HTTPS on your own domain.