Skip to content

Panel at home behind NAT (subscription host)

github-actions[bot] edited this page Dec 2, 2026 · 1 revision

Run the panel without a public address: one node serves the subscription address and the agents' link on a subdomain, over a bridge the panel opens to it.

A panel needs a public address for two things: people fetch their subscriptions from it, and every agent dials it for its link. A panel at home, behind the router's NAT or the provider's CGNAT, has no such address. The subscription host solves this: one of your nodes serves a subdomain, for example sub.example.com, and hands its connections to the panel.

The panel opens the connection itself: it calls the host's own site on port 443 like a browser and keeps a few HTTP/2 connections open, so nothing has to reach your home network. TLS of the subdomain ends in the panel, which holds its certificate and key. The node only passes the encrypted bytes along; it stores no subscription, token or key. The admin page never goes through the host: it stays on the panel's own address or a local listener. The design is in design/adr/0018-panel-behind-nat.md.

This is the VPS edition only. The Cloudflare edition already has a public address and does not show the card.

Requirements

  • The host's port 443 belongs to the node's own site. One of these:

    • a profile on TCP 443 that serves a site of its own: VLESS with TLS, VLESS REALITY whose target is the node itself, TrustTunnel, or MTProto with its decoy site;
    • nothing on 443: then give a Site name, a second name pointing at the node. The agent shows a site for it there and gets a certificate (self-signed until Let's Encrypt issues one).

    Refused: a REALITY profile on 443 whose target is someone else's site, a Hysteria2 site on TCP 443, a profile on 443 that cannot share the port, and a profile that answers to the subdomain itself. The panel names the reason; the node's profiles keep running.

  • Every agent supports authenticated control through the host. Update nodes without sub-host-control/1 before enabling the host (Updates). Existing mTLS nodes keep mTLS.

  • DNS records. An A record for the subdomain pointing at the node's address, an AAAA record if the node has IPv6, and the same for the site name if you give one. The panel checks them before it enables the host; Check records shows what they resolve to.

  • The host node must be online and not retired.

A fresh panel at home

  1. Set the panel up without --public-url, with the admin on a local listener:

    mistgate setup --admin-listen 127.0.0.1:8081

    Open the admin at http://localhost:8081/ on that machine, or through an SSH tunnel. See Install the panel for the rest of the setup.

  2. Create the A (and AAAA) records of the subdomain and of a second name for the node's site, both pointing at the server that becomes the first node.

  3. Go to Nodes → Add node and install the node over SSH (Install a node over SSH). On the server step, tick This node is the subscription host and enter the Subdomain and the Site name.

    The node cannot reach a panel behind NAT yet, so the server check marks the panel as unreachable without stopping, and the panel enrolls the node inside the SSH session: the node makes its key, the panel signs it, and the role and the link address go to the node on standard input, never on its command line. If a record does not point at the server, the install stops with a DNS error; Continue anyway goes on without the check, for example behind a DNS proxy. If the install fails after the role is on, the panel turns the role off again.

  4. Once the node is connected, open Settings → Domains from the last step of the wizard. Add the CAA record using the displayed value and wait until the host is ready before creating subscription links.

Enabling on an existing panel

Open Settings → Domains → Subscription host → Set up subscription host:

  1. Choose the Node and enter the Subdomain, and the Site name if no profile on the node's 443 serves its own site. When the node's address is a host name, it is filled in as the site name; change it if you like.
  2. Check records shows the addresses the names resolve to now and the addresses expected.
  3. Enable. If a record does not point at the node, the panel refuses and offers Enable anyway. Use it only when you know the record is right, for example behind a DNS proxy.

Ready

Nothing moves until the host is ready. Until then the card lists the steps and ticks each one as it comes true:

  1. The node is online.
  2. The node took the role (an unfit role names its reason; nothing is installed then).
  3. The node's site has a public certificate.
  4. The panel's bridge to the node is up.
  5. The panel has a certificate for the subdomain (Let's Encrypt, through the host; the panel asks for it once its bridge is up).
  6. DNS has the CAA record that limits the subdomain's certificates to this panel (see CAA record), or the owner proceeds without it.

Once all hold, the panel records sub_host_ready and the Base of the subscription links becomes the subdomain (via subscription host). Agents learn the authenticated route and try it on reconnect: mTLS stays mTLS, and link agents keep their old address until a session succeeds on the new one. New nodes enroll over the subdomain's link. Losing readiness later does not move anything back.

While the host is on, the card shows the domain, the site name, the node, the bridge (bridge up or bridge down with the reason, and since when) and the CAA record. The panel records sub_host_tunnel_down when the bridge stays down and sub_host_tunnel_up when it is back.

What a visitor sees: a connection the panel cannot take goes to the node's own site. The host admits up to 400 connections and reserves capacity for agents based on fleet size (up to 256). Public connections cannot use that reserve, even from a node's address. At about three quarters of public capacity, the limits are 16 per address (IPv6 by /64) and 64 per network (IPv4 /24 or IPv6 /48). A public connection above a limit waits up to two seconds.

CAA record

The subdomain points at the host, so whoever takes over the node could get a certificate of their own for it and read the subscriptions it carries. Only a CAA record that names this panel's certificate account stops that. The card shows the record once the panel has its account (it gets one when it first asks for the subdomain's certificate); publish it in your DNS. The line below it says whether the panel found a matching record, is waiting for its certificate account, or couldn't check DNS. The host is not ready until the record is published.

The displayed value must be the only issue value in the nearest applicable CAA record set. A second issuer leaves the subdomain unprotected. Once the subdomain is active, confirmed loss of this restriction emits the sub_host_caa_lost warning without rolling back the address or blocking a move. Restore the matching record to protect the subdomain.

If your DNS provider cannot publish CAA records, Proceed without CAA lets the host become ready without it, after a fresh sign-in. The panel audits it, records the warning event sub_host_caa_waived and says so on the card. The choice holds for this subdomain and this certificate account only: a new subdomain, or a new account, asks again. Through MCP it is the plan subscription_host_caa_waive.

The record names the panel's certificate account. A panel restored or moved without its acme directory gets a new account: Let's Encrypt then refuses to renew the subdomain's certificate until you replace the record with the one the card shows.

Profiles on the host

While a node is the host, the panel refuses a change to its profiles that would leave it unfit (sub_host_inbound_unfit): a REALITY profile on 443 that borrows another site, a Hysteria2 site on 443, a profile that takes the subdomain, or switching off or deleting the only site on 443 when there is no site name. Keep the port for the node's own site, or move the host first.

TCP 443 also cannot be used by a relay on the host, including a standalone reverse relay bridge. Move the relay or use another node as the host.

If you configured a Site name, the agent keeps its own site available for the bridge even when a profile on 443 fails to start. A working profile using that same name still receives matching connections.

Moving to another node

Both the move and turning the host off happen in two phases, and you finish each one yourself.

  1. Open Move subscription host, choose the node (and its Site name if it needs one), and press Start the move.
  2. At DNS, add or update the A (and AAAA, when shown) records in your DNS provider using the table in the wizard. Leave CAA unchanged. In Cloudflare select DNS only (grey cloud). The panel checks the records every 15 seconds; Check DNS checks immediately.
  3. Press Finish once DNS points to the new node, the new node can carry the subdomain, and the fleet has saved the new route. The wizard shows which nodes have not confirmed the route. Forcing completion can disconnect those nodes. Cancel move keeps the current host; closing the wizard does not cancel a started move. Reopen it with Continue move.

If the previous host is gone: In the same move form, select the replacement and start the move. If that node is offline and the previous bridge is down, the panel offers Prepare this node over SSH. This uses saved, verified SSH access and the node's existing registration. The agent restarts, so VPN connections on that node may be interrupted briefly. If preparation is interrupted, retry it on the same node before changing the subscription DNS record. If you entered a site name for the successor, that name must already point at it so it can obtain its site certificate.

If the old host never became ready, turn it off and set up the replacement instead. The panel and agents are still using the original address.

Once the new bridge is up, point the same subdomain at the replacement. Existing subscription links do not change. If a node is still waiting after DNS matches, you can refresh its route over SSH without making it a host. A node the panel cannot reach stays in the list.

If the previous host is permanently lost, confirm Finish without the previous host separately. DNS, successor readiness, and every other node's acknowledgement are still required. The previous node is not removed.

Cancelling withdraws the new host's role. If SSH cleanup fails, open Continue move to retry. If you can't restore SSH access, choose Cancel without SSH and confirm. Recovery settings can remain on the new node until its agent reconnects. Neither option restores the previous bridge or undoes DNS changes.

Turning it off

A host that never became ready turns off at once: nothing moved to it, so the panel keeps its address.

  1. Open Turn off. Under Address the panel goes back to, enter https://host[:port]. Leave it empty only if the panel will have no public address: the panel asks first, since it then hands out no subscription links and nodes cannot reach it.
  2. Press Turn off. The panel goes back to that address. On reconnect, link agents try the new address and mTLS agents try their original endpoint first.
  3. The wizard lists the nodes Not yet on the new address, including offline nodes and the subscription host itself. Once the list is empty, press Finish. Forcing completion can disconnect nodes that have not returned (see Offline nodes). Cancel turning off keeps the host on. If you close the wizard instead, reopen it with Continue turning off.

Moving a public panel home

  1. On the public panel, enable the subscription host as above and wait until it is ready, so that people and agents use the subdomain.

  2. Wait until no node uses the panel's own address any more.

  3. Take an encrypted backup.

  4. At home, restore it into a new data directory with mistgate backup restore (Restore on a new panel).

  5. Move the admin to a local listener with mistgate admin-address, then start the panel:

    mistgate admin-address --admin-listen 127.0.0.1:8081 --data-dir NEW-DIR
  6. Stop the old panel. The home panel dials the host, and the nodes reach it through the subdomain.

Passkeys are bound to the admin's address, so they stop working at the new address. Sign in with your password and authenticator code, then add your passkeys again (Security).

Offline nodes

A node that was offline while the address changed did not receive the new link address. On that node, run:

mistgate-node set-panel --link-url wss://sub.example.com/<secret-prefix>/
systemctl restart mistgate-node

The agent tries the new address and its current one in turn, and keeps the new one once a session over it succeeds (CLI).

Agents that reach the panel only by the link

Link-only agents still use the signed WebSocket link. An agent with link-fetch/1 downloads update files and the network table with its link session token.

MCP

An Admin-profile token reads the state with subscription_host_get. It changes the host through subscription_host_set, subscription_host_move (start, finish, cancel) and subscription_host_disable. Every change is a plan that the owner approves with a fresh sign-in, and no tool shows the bridge path or the link prefix. node_install takes subscription_host_domain, site_name and skip_dns_check for a first host. See MCP.

Known limits

  • The host is a single point for subscriptions and links; move it to another node when it has to go down.
  • The bridge keeps separate long-lived connections for public traffic and agent control. A visitor of the subdomain during an outage sees the node's certificate for another name.
  • The panel's certificate for the subdomain is renewed through the host: a host that stays down long enough lets it expire.
  • A Hysteria2 site cannot share TCP 443 with the host yet.

Edit this page · View on mistgate.app

Mistgate

English

Getting started

Guide

Operations

Roadmap

Reference

Русский

Начало работы

Руководство

Эксплуатация

План развития

Справочник

简体中文

入门

使用指南

运维

路线图

参考

Clone this wiki locally