Skip to content

Manage an IoT Fleet Behind CGNAT with Localtonet

Run an IoT fleet behind CGNAT: per-device tokens, Connected/Disconnected webhooks, TCP tunnels vs VPN Manager mesh, and secure token rotation.

Summary in your language
In this article 14 sections
IoT gateway and LTE cellular router installed in an outdoor field enclosure
Field devices on cellular links usually sit behind carrier-grade NAT with no public inbound address.
IoT · CGNAT Fleet Management · Localtonet · 2026

Reach, watch and safely retire hundreds of field devices that have no public IP address

Field devices usually sit behind home routers, carrier-grade NAT or cellular links, so nothing on the internet can connect to them directly. Managing one device like this is a solved problem. Managing a whole fleet raises harder questions: which unit is which, which ones went offline overnight, how to cut off one compromised device without touching the others, and whether every device really needs a publicly reachable management port. This guide shows how we structure a multi-device deployment with Localtonet using per-device tokens, Token Group webhooks for online/offline visibility, per-device TCP tunnels or a VPN Manager mesh for access, and a tunnel lifecycle that fits maintenance windows.

🔒 One token per device, revocable on its own 🌐 Outbound-only connections, no port forwarding ⚡ Connected/Disconnected webhooks for fleet status

Why field devices behind CGNAT cannot accept inbound connections

Diagram comparing blocked inbound connections through CGNAT with an outbound tunnel initiated by the device
CGNAT drops unsolicited inbound traffic, so the device must open the connection outward.

A device in the field almost never has a public IP address of its own. A Raspberry Pi in a customer's home sits behind the customer's router, which translates many private addresses (such as 192.168.1.0/24) into the single public address the ISP assigned. That is ordinary NAT, and it already means you cannot connect to the Pi unless someone configures port forwarding on that router. In a fleet deployment you rarely control that router, and asking every customer or site owner to open ports is neither practical nor safe.

Carrier-grade NAT (CGNAT) makes the situation stricter. With CGNAT the ISP or mobile carrier does not give the customer's router a public address at all. The router receives an address from a shared range (often 100.64.0.0/10, the block reserved for this purpose), and the carrier performs a second layer of translation on its own equipment. Even if you could configure port forwarding on the site router, there is no public address pointing at that router to forward from. Cellular IoT is the most common example: LTE and 5G modems and routers very frequently receive CGNAT addresses, and some carriers also filter unsolicited inbound traffic entirely.

Corporate and industrial networks add their own layer: firewalls that allow outbound HTTPS but drop anything unsolicited from the internet. The practical result for a fleet operator is the same across all three environments. The device can usually reach out to the internet, but the internet cannot reach in.

What does not scale

Teams typically try a few workarounds before looking for a structural fix:

  • Port forwarding per site: requires access to every router, breaks under CGNAT, and leaves management ports exposed on residential IP addresses that change over time.
  • Paying for static public IPs: often unavailable on consumer or cellular plans, expensive across hundreds of units, and still exposes each device directly.
  • Dynamic DNS: solves changing addresses, not the absence of a reachable address. It does nothing under CGNAT.
  • Site visits: the fallback that every operator wants to avoid, especially for a configuration change that would take two minutes with a shell.

Why outbound-initiated tunnels work

The fix is to reverse the direction of the connection. Instead of trying to reach the device, the device reaches out. With Localtonet, the client application on each device establishes an outbound connection to one of our relay servers. Because the connection is initiated from inside the network, it passes through home NAT, CGNAT and typical outbound-permitting firewalls the same way a browser session does. Our relay then provides a public URL or a public host and port, or in the case of VPN Manager a private mesh network, and traffic for the device travels back along that established connection.

Nothing is opened on the site router, no public IP is required, and no VPN appliance needs to be installed at the site. One important consequence, which shapes everything later in this guide: a tunnel is only available while the device's client is connected and the tunnel is running. That is not a limitation to work around. For a fleet, it is a signal you can monitor.

Useful to know

Outbound-initiated tunnels change how a device is reached, not who is allowed to use it. A tunnel does not bypass authentication on the service behind it. SSH keys, application logins and access rules on the device still apply and should stay strict.

What you need before you start

This guide is written for fleets of Linux single-board computers and gateways, with the Raspberry Pi as the running example, but the structure applies to any device that can run the Localtonet client. Before onboarding the first unit, make sure you have:

  • A Localtonet account that you will use to manage the fleet from a single dashboard. Plan limits, such as how many devices or tunnels you can run at once, are not covered in this article; check your current plan in the dashboard before sizing a rollout.
  • The Localtonet client for each device's operating system. Install it from our official download and documentation pages, listed on our Localtonet documentation hub. We do not reproduce install commands here because the current, supported install method for your OS and CPU architecture should always be taken from those pages.
  • A device inventory: a spreadsheet, database or CMDB entry for each unit with a stable device name, site, hardware type and owner. You will attach each device's token to this record.
  • The services you intend to reach on each device, for example OpenSSH listening on port 22, a local management agent, or a web dashboard, along with the local IP address and port each one listens on.
  • A place to run a webhook receiver if you want fleet online/offline visibility. This can be a small server you already operate or a machine at your operations office.
Keeping the client running after reboots

Field devices reboot after power cuts and updates, so the Localtonet client must come back on its own. Our verified material for this article does not document a specific service or autostart command for the client on every OS. Check the current install instructions for your platform in the documentation hub for supported service options. If you supervise the client with your own init system (for example a systemd unit), test a full power cycle on one device and confirm it reconnects before you ship the image to the field.

How we structure a fleet deployment with Localtonet

A single-device setup needs one tunnel and one person who knows its address. A fleet needs identity, visibility, a chosen access model and a lifecycle. These map directly onto concepts in our platform.

🔑 Device identity: auth tokens Each Localtonet token identifies one client device. Giving every unit its own token means every unit can be identified, revoked or rotated independently.
📡 Visibility: Token Group webhooks Platform-wide webhooks fire when a token or tunnel in a selected Token Group changes to Connected or Disconnected, posting a small JSON body to your receiver.
🖥️ Per-device access: TCP tunnels A TCP tunnel points a public host and port at a local IP address and port on the device, such as 127.0.0.1:22 for SSH.
🕸️ Fleet-wide private access: VPN Manager Our free private mesh VPN with granular firewall rules connects devices to each other and to operator machines, and can bridge local LANs, without publishing management ports.
🔁 Lifecycle: create, start, stop, delete Creating a tunnel does not run it. Tunnels are started, stopped and deleted explicitly, which fits on-demand maintenance access.
🗺️ Relay server selection Each tunnel uses a relay server or region you select in the dashboard. Choose one close to your operators or devices from the currently available list.

The rest of this guide works through these building blocks in the order you need them: identity first, then onboarding, then monitoring, then the access model, then operations and security.

Per-device tokens: identity, revocation and rotation

The most important fleet decision is made before any tunnel exists: one token per physical device. Localtonet tokens are device-specific by design. They identify which client device will run a tunnel, and they must never be guessed, shared or exposed.

It can be tempting to reuse one token across a batch of identical devices, because it makes the golden image simpler. Avoid this. A shared token removes every benefit a fleet operator needs:

  • Identification: if fifty devices share a token, a Connected or Disconnected event cannot tell you which unit changed state.
  • Revocation: if one unit is stolen or compromised, revoking its token cuts off every device that shares it.
  • Rotation: rotating a shared token requires touching every device at once, usually during a coordinated outage.
  • Blast radius: anyone who extracts the token from one SD card holds the identity of the whole batch.

Tie each token to an inventory record

Record which token belongs to which device in your inventory, but do not store the raw token in a widely readable spreadsheet. A good pattern is to store a fingerprint, such as a SHA-256 hash of the token, next to the device name. That lets your systems map an incoming event to a device without your inventory becoming a list of live credentials. The webhook receiver later in this guide uses exactly this approach. You can compute a fingerprint on an operator workstation without echoing the token to the screen or shell history:

read -rs TOKEN
printf '%s' "$TOKEN" | sha256sum
unset TOKEN

Store the resulting hex string alongside the device's name, site and hardware revision. Keep the raw token only in your secrets manager and on the device itself.

Never bake tokens into shared images

Most fleets are provisioned by flashing a common OS image. If that image already contains a token, every flashed card carries the same identity, and the token lives forever in your build artifacts, image registry and any SD card that leaves the building. Instead, keep the golden image token-free and inject the device-specific token during a per-unit provisioning step: at first boot from a secure provisioning service, from a separate configuration partition written per device, or manually on the bench before shipping. The exact mechanism depends on your provisioning tooling; the rule is that the token is added per device, after imaging.

Rotation

Rotation means replacing a device's token with a new one and invalidating the old one. Common triggers are a suspected leak, an employee with access leaving, an RMA where the device passed through unknown hands, or a routine schedule. Our verified material for this article does not describe the exact dashboard controls for regenerating or revoking an individual token, so confirm the current options in your dashboard and in the documentation hub before writing a runbook. Operationally, a safe rotation for a single device looks like this:

  1. Obtain the new token for the device through the dashboard.
  2. Deliver it to the device over an existing trusted session (for example the current SSH session over the tunnel or the VPN Manager mesh), and update the client configuration.
  3. Restart the client and confirm the device reconnects under the new identity. Your webhook receiver should show a Connected event that maps to the device via its new fingerprint.
  4. Invalidate the old token and update the inventory fingerprint.

Because tokens are per device, this procedure touches exactly one unit. If anything goes wrong, only that unit needs attention.

Onboarding a device: the per-unit workflow

Once the token strategy is settled, onboarding each unit follows the same six-stage workflow that applies to every Localtonet setup. Repeat it per device, and script the parts that live on your side (inventory updates, image provisioning) so the process stays consistent across hundreds of units.

1

Install and run the Localtonet client on the device

Install the client for the device's OS from our official download and documentation pages, on the device that can reach the local service you want to expose. For a Raspberry Pi gateway, that is usually the Pi itself.

2

Authenticate the device with its own token

Supply the device-specific token you created for this unit, injected per device rather than from the shared image. Record the token's fingerprint in your inventory.

3

Select a relay server or region

Choose from the relay servers currently available in the dashboard. Use the live list rather than a hardcoded value, since available servers can change.

4

Create the right configuration for the job

Create a TCP tunnel pointing at the local IP and port of the service (for example 127.0.0.1:22 for SSH), an HTTP tunnel for a local web UI, or add the device to your VPN Manager network if you use the mesh model.

5

Start the tunnel and note the public address

A newly created tunnel does not run until you press Start. Once running, use the assigned public host and port or URL, and record it against the device in your inventory.

6

Stop or delete the tunnel when it is not needed

Stop tunnels outside maintenance windows if you do not need permanent access, and delete them when a device is decommissioned. This keeps the exposed surface of the fleet as small as possible.

Verify locally before you rely on the tunnel

Most "the tunnel doesn't work" reports are really "the service isn't listening". Before creating a tunnel for a service, confirm on the device that it is running and listening on the address and port you will enter as the local target. On most Linux distributions, including Raspberry Pi OS, you can check listening TCP sockets with:

ss -tlnp

Look for the expected port (for example :22 for OpenSSH) bound to 127.0.0.1, 0.0.0.0 or the device's LAN address. If the service only listens on a specific LAN address, use that address as the tunnel's local target rather than 127.0.0.1. Then, from an operator machine, connect through the public address assigned to the tunnel. For SSH through a TCP tunnel, that uses standard OpenSSH syntax with the host and port shown in the dashboard:

ssh -p <PUBLIC_PORT> <USER>@<PUBLIC_HOST>

Replace the placeholders with the values assigned to that specific tunnel. Do not share these addresses publicly, and never paste them alongside credentials in tickets or chat.

Fleet online/offline visibility with Token Group webhooks

Diagram of devices in a token group triggering Connected and Disconnected webhooks to a receiver
Token Group webhooks report Connected and Disconnected events to your own receiver.

With ten devices you can glance at the dashboard. With three hundred spread across homes, farms and cellular routers, you need the platform to tell you when something changes. Our platform-wide Token/Tunnel webhooks do this.

You select a Token Group, and whenever a token or tunnel in that group changes to Connected or Disconnected, our platform sends an HTTP POST to your receiver with a WebHookRequest JSON body. The documented fields are:

Field Meaning How a fleet receiver should use it
Id The tunnel id, or the authtoken, depending on the event type Map to a device or tunnel via your inventory. For Token events this value is a credential, so fingerprint it and never log it raw.
ActionDate When the state change happened Store with the event and use it in alerts and outage-duration calculations.
Type "Token" or "Tunnel" Token events reflect the device's client connection; Tunnel events reflect an individual tunnel.
Status "Connected" or "Disconnected" Drive the device's online/offline state and alerting.

For the configuration screens and current options, see our Localtonet webhook documentation.

Token events vs Tunnel events

The two event types answer different operational questions. A Token event tells you whether a device's Localtonet client is connected at all, which for a remote unit is effectively "is this device alive and online". A Tunnel event tells you whether a specific tunnel, such as the SSH tunnel on that device, is up. A device can be online with a tunnel stopped (for example outside a maintenance window), so treat Token events as the primary health signal and Tunnel events as service-level detail.

Designing Token Groups for a fleet

Because webhooks are scoped to a selected Token Group, the way you group tokens decides what each receiver sees. Useful groupings include:

  • By environment: production devices in one group, lab and staging units in another, so bench reboots do not page anyone.
  • By customer or site: useful when different teams own different deployments or when you forward status to customer-specific systems.
  • By criticality: devices whose outage needs an immediate response separated from devices where a daily report is enough.

Do not alert on every disconnect

Field connectivity is noisy. Cellular links drop briefly, residential routers reboot overnight, and power blips restart devices. If every Disconnected event pages someone, alert fatigue arrives within a week. A better pattern is a grace period: when a Disconnected event arrives, wait several minutes; if no Connected event for the same device arrives in that time, raise an alert. Separately, count disconnects per device per day. A device that reconnects within the grace period but drops twenty times a day usually has a weak signal, a failing power supply or an SD card problem, and deserves a ticket even though it never triggers an outage alert.

Two different webhook systems

The Token/Tunnel webhooks described here are separate from File Server webhooks, which fire on file events such as uploads and deletions and support HMAC signing. Our documentation for the platform-wide Token/Tunnel webhooks covers the payload fields above; it does not describe request signing for these events. Do not assume HMAC verification exists for them, and protect your receiver accordingly (see below).

Build a minimal webhook receiver for fleet status

The receiver below is a starting point written with only the Python standard library, so it runs on almost any Linux host, including a spare Raspberry Pi at your operations office. It does five things: accepts POSTs only on a secret path, validates that the body contains the documented fields with documented values, maps the Id to a device name through a fingerprint inventory, applies a grace period before raising an offline alert, and avoids writing raw identifiers to logs.

First create an inventory file that maps fingerprints to names. Add both device token fingerprints (for Token events) and tunnel id fingerprints (for Tunnel events) if you want both mapped:

{
  "3f1c...replace-with-sha256-of-token...": "pump-station-07",
  "9ab2...replace-with-sha256-of-tunnel-id...": "pump-station-07 ssh tunnel"
}

Then the receiver itself:

#!/usr/bin/env python3
"""Minimal receiver for Localtonet Token/Tunnel webhooks.

Parses the documented WebHookRequest fields: Id, ActionDate, Type, Status.
"""
import hashlib
import json
import os
import threading
import time
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer

LISTEN_HOST = "127.0.0.1"   # keep it local; publish it deliberately
LISTEN_PORT = 8080
SECRET_PATH = os.environ.get("WEBHOOK_PATH", "/hooks/change-me")
GRACE_SECONDS = int(os.environ.get("GRACE_SECONDS", "300"))
MAX_BODY = 10_000

with open("inventory.json", encoding="utf-8") as f:
    INVENTORY = json.load(f)  # {"<sha256 hex>": "friendly name"}

state = {}     # fingerprint -> last event
pending = {}   # fingerprint -> ActionDate of an unresolved disconnect
lock = threading.Lock()

def fingerprint(value: str) -> str:
    return hashlib.sha256(value.encode("utf-8")).hexdigest()

def alert(message: str) -> None:
    # Replace with your pager, chat or ticketing integration.
    print(f"ALERT {message}", flush=True)

def confirm_offline(key: str, name: str, action_date: str) -> None:
    time.sleep(GRACE_SECONDS)
    with lock:
        if pending.get(key) == action_date:
            alert(f"{name} still disconnected since {action_date}")

class Handler(BaseHTTPRequestHandler):
    def _reply(self, code: int) -> None:
        self.send_response(code)
        self.end_headers()

    def do_POST(self):
        if self.path != SECRET_PATH:
            return self._reply(404)

        length = int(self.headers.get("Content-Length", "0") or 0)
        if length <= 0 or length > MAX_BODY:
            return self._reply(400)

        try:
            event = json.loads(self.rfile.read(length))
        except (ValueError, UnicodeDecodeError):
            return self._reply(400)

        kind = event.get("Type")
        status = event.get("Status")
        raw_id = str(event.get("Id", ""))
        action_date = str(event.get("ActionDate", ""))

        if kind not in ("Token", "Tunnel") or status not in ("Connected", "Disconnected") or not raw_id:
            return self._reply(400)

        key = fingerprint(raw_id)
        name = INVENTORY.get(key, f"unknown-{key[:12]}")

        with lock:
            was_pending = key in pending
            state[key] = {"name": name, "type": kind, "status": status, "at": action_date}
            if status == "Disconnected":
                pending[key] = action_date
                threading.Thread(
                    target=confirm_offline, args=(key, name, action_date), daemon=True
                ).start()
            else:
                pending.pop(key, None)

        print(f"{action_date} {kind} {name} {status}", flush=True)
        if status == "Connected" and was_pending:
            print(f"{name} reconnected within grace period", flush=True)

        self._reply(204)

    def log_message(self, *args):
        # Default logging would print the secret path; keep it quiet.
        pass

if __name__ == "__main__":
    ThreadingHTTPServer((LISTEN_HOST, LISTEN_PORT), Handler).serve_forever()

Save it as receiver.py, choose a long random path, and start it:

export WEBHOOK_PATH="/hooks/$(openssl rand -hex 16)"
echo "$WEBHOOK_PATH"   # note it once, then keep it in your secrets store
python3 receiver.py

Test it locally before connecting it to the platform

Send a sample event from the same machine. The ActionDate value below is only an illustration; the receiver treats it as an opaque string, so the exact format our platform sends does not matter to this code.

curl -i -X POST "http://127.0.0.1:8080$WEBHOOK_PATH" \
  -H "Content-Type: application/json" \
  -d '{"Id":"example-tunnel-id","ActionDate":"2026-01-01T00:00:00Z","Type":"Tunnel","Status":"Disconnected"}'

You should receive HTTP/1.0 204 No Content and see a log line naming an unknown- device (because the example id is not in your inventory). After the grace period, an ALERT line appears. Send the same body with "Status":"Connected" within the grace period and the alert is suppressed. When you connect the receiver to a real Token Group, the first genuine events are a good moment to confirm field formats against what you see, then adjust parsing or storage if needed.

Making the receiver reachable

Our platform needs to reach the receiver over the internet. If it runs on a server with a public HTTPS endpoint, use that. If it runs on a machine behind NAT at your office, you can publish it with a Localtonet HTTP tunnel that points at 127.0.0.1:8080, which gives it a public HTTPS address; see the Localtonet HTTP tunnel documentation for that workflow. Either way, the full receiver URL you enter in the webhook settings is the public base address plus your secret path.

Protect the receiver

Since request signing is not documented for Token/Tunnel webhooks, treat the secret path as your shared secret, serve it only over HTTPS, keep the body size limit, and never trust an event to trigger destructive actions on its own. Use events to update status and raise alerts; if you automate anything stronger, confirm the device's state through the dashboard or API first. Because Token events carry the authtoken in Id, make sure no proxy, load balancer or logging layer in front of the receiver records request bodies.

Ordering and delivery caveats

Our verified material does not specify retry behavior or guarantee event ordering for these webhooks. Design for that: if your receiver is down, you may miss transitions, so reconcile periodically against the dashboard (or the REST API, see below) rather than assuming the receiver's view is complete. If two events for the same device arrive close together, the receiver above simply keeps the latest one it processed; if ordering matters for your reporting, compare ActionDate values once you have confirmed their format.

Choosing an access model: per-device TCP tunnels vs VPN Manager

Side-by-side diagram of per-device TCP tunnels versus a VPN Manager mesh network
TCP tunnels expose one service per device; VPN Manager places devices on a shared private network.

Knowing a device is online is half of fleet management. The other half is reaching it to act: an SSH shell, an scp of a log bundle, a configuration agent, a local web interface. Our platform offers two quite different ways to do this, and fleets often use both.

Per-device TCP tunnels

A TCP tunnel forwards a public host and port to a local IP address and port reachable from the device. Point it at 127.0.0.1:22 and you have SSH; point it at the port of a management agent's listener and that agent becomes reachable. TCP tunnels are simple to reason about: one tunnel, one device, one service, one address. They work with any TCP-based tool without installing anything on the operator side beyond the normal client, such as ssh.

The trade-off is exposure. A public host and port is reachable by anyone who learns or scans it, so the service behind it carries the full burden of authentication. That is acceptable for well-hardened SSH with key-only login, but not for services designed for trusted networks, such as a database port, an MQTT broker without authentication, or a vendor web UI with a default password. For a web interface specifically, an HTTP tunnel gives it a public HTTPS address instead of a raw port, but the same rule applies: the application's own login must be strong.

VPN Manager mesh

VPN Manager is our free private mesh VPN with granular firewall rules, and it can bridge local LANs. Unlike TCP and HTTP tunnels, which publish a service, VPN Manager places devices and operator machines on a private network, so management ports are reached privately rather than published to the internet. Firewall rules let you decide which members can talk to which, for example allowing operator laptops to reach port 22 on all field devices while preventing field devices from reaching each other. Bridging LANs is useful when a gateway device sits on a site network with other equipment (PLCs, cameras, sensors) that you need to reach without installing anything on that equipment. For an overview, read our post on the Localtonet VPN Manager free private mesh network.

Criterion Per-device TCP tunnel VPN Manager mesh
Reachability Public host and port per service Private addresses inside the mesh only
Exposure of management ports Published to the internet; service authentication must be strong Not published; access governed by membership and firewall rules
Operator side Standard tools such as ssh with the assigned host and port Operator machine joins the mesh, then connects to device addresses
Scope One service on one device per tunnel Whole fleet, multiple ports, and bridged site LANs
Best for Occasional SSH to a few units, third-party access to one device, quick fixes Daily operations across many devices, sensitive management interfaces, site equipment behind a gateway
Fits on-demand windows Yes: start for the window, stop afterwards Use firewall rules and membership to scope access over time

A practical split for most fleets

In our experience, the cleanest structure is: VPN Manager as the default management plane for operators, with firewall rules limiting which members reach which ports; and per-device TCP tunnels reserved for exceptions, such as giving a contractor time-limited SSH to one unit without adding them to your mesh, or reaching a device during a VPN Manager change. Webhooks sit alongside both, because the Token event tells you whether the device's client is connected regardless of which access model you use.

Tunnels are not a VPN

HTTP, TCP, UDP and File Server tunnels publish specific services. They do not create a private network between your machines. If your requirement is "only our team can reach these management ports", VPN Manager is the feature built for that, not a TCP tunnel with a hard-to-guess port.

Tunnel lifecycle and on-demand maintenance windows

Every Localtonet tunnel moves through an explicit lifecycle: it is created, then started, then optionally stopped, and finally deleted. Creating a tunnel does not make it reachable. It must be started with the Start button, and it is only available while the device's client is connected and the tunnel is running.

For fleets, this lifecycle is a security tool. Many devices do not need a reachable SSH port 24 hours a day. A typical maintenance pattern looks like this:

  1. Prepare in advance: create the TCP tunnel for each device that will be serviced, pointing at its SSH port. Leave it stopped.
  2. Open the window: start the tunnels for the devices in this batch. Tunnel Connected events confirm they are live.
  3. Do the work: connect over the assigned addresses, apply changes, collect logs.
  4. Close the window: stop the tunnels. Tunnel Disconnected events confirm closure, and your receiver can flag any tunnel that is still running after the window should have ended.
  5. Clean up: delete tunnels that will not be reused, for example after a one-off contractor engagement.

Note that stopping a tunnel does not disconnect the device's client. Your Token events should continue to show the device as connected, which is exactly what you want: health monitoring keeps working while access is closed.

Rolling changes safely

Our platform gives you reachability, not a fleet-wide update system. Changes still happen on each device through your own tooling: a shell, a configuration management agent, or a dedicated OTA updater. Whatever tool you use, the habits that prevent mass outages are the same:

  • Canary first: apply a change to one device, ideally one you can physically reach, and let it run through at least one reboot and a normal day of operation.
  • Small batches: expand to a few percent of the fleet, then larger groups. Watch your webhook receiver for Disconnected events that do not recover after each batch.
  • Protect the connection itself: be especially careful with changes to networking, firewall rules, time synchronization, storage and the Localtonet client's own configuration. A mistake here can cut off remote access to the very device you are fixing.
  • Keep a fallback path: if a device is reachable through both VPN Manager and an on-demand TCP tunnel, a misconfiguration in one path does not leave you locked out.

Security practices for a remotely managed fleet

Removing the need for port forwarding reduces one class of risk, but a fleet of internet-reachable devices still needs deliberate security design. These practices apply whichever access model you choose.

Least privilege everywhere

  • Expose only what is needed: each tunnel should point at exactly one service. Do not forward ports "just in case".
  • Scope operator access: in VPN Manager, use firewall rules so operator machines reach only the management ports they need, and devices cannot freely reach each other unless your application requires it.
  • Limit who manages the account: the dashboard controls every token and tunnel in the fleet. Restrict who has access and protect that access accordingly.

Harden the services behind the tunnels

For SSH, which is the most common fleet management service, standard OpenSSH hardening applies. In /etc/ssh/sshd_config on the device, disabling password logins and root logins is the usual baseline:

PasswordAuthentication no
PermitRootLogin no

Install operator public keys before applying this, test login in a second session before closing the first, and then reload the SSH service using your distribution's normal method. Remove default users and default passwords from the image. Many SBC images historically shipped with well-known credentials, and a published TCP port will be found by scanners.

Keep management ports off public exposure where VPN Manager fits

If a service was designed for a trusted LAN (an industrial protocol, a broker without authentication, a camera's admin UI, a database), do not publish it with a TCP or HTTP tunnel. Reach it through VPN Manager instead, where it stays private and firewall rules control who can connect.

Treat tokens as credentials

  • One token per device, injected after imaging, never committed to a repository or stored in a shared image.
  • Restrict file permissions on any configuration file holding the token on the device.
  • Mask or fingerprint tokens in logs, including webhook receiver logs, since Token events carry the authtoken in Id.
  • Rotate on suspicion, after an RMA, and on a schedule that matches your risk profile.

Handling a lost, stolen or decommissioned device

Flow showing a lost device's token being revoked while the rest of the fleet stays connected
Revoking one device's token cuts its access without affecting the rest of the fleet.

Devices in the field get stolen, replaced under warranty, or retired. Each of these events should trigger a runbook, because a device you no longer control still holds a credential that can connect to your account.

Situation Immediate action Follow-up
Device lost or stolen Stop and delete its tunnels; revoke its token Remove it from VPN Manager and its firewall rules; rotate any secrets stored on the device (API keys, Wi-Fi passwords, SSH host keys trusted elsewhere)
Planned decommission Stop and delete tunnels; revoke the token Wipe storage before disposal; mark retired in inventory so a later Connected event for its fingerprint is treated as suspicious
RMA or repair by a third party Revoke the token before shipping Provision a fresh token when the unit returns, as if it were a new device
Device replaced on site Provision the replacement with its own new token Retire the old unit's token and tunnels; update the inventory mapping

Because every device has its own token, none of these actions affect the rest of the fleet. That is the payoff of the per-device identity decision made at the start. As with rotation, confirm the exact revoke controls in your dashboard before relying on a written runbook.

Use webhooks as a tripwire

Keep retired fingerprints in your receiver's inventory, labeled as retired. If one of them ever produces a Connected event, something is wrong: a token was not revoked, or a device you believe is gone is back online. Alert on it.

Troubleshooting common fleet problems

A device shows Disconnected and never comes back

The Localtonet client on that device is not connected. Work through the likely causes from the outside in: the site lost power or internet; the cellular link lost signal or data allowance; the device rebooted and the client is not configured to start automatically; the token was revoked or replaced; or outbound connections are blocked by a new firewall at the site. If the device is also on VPN Manager or has another management path, check from there first. Otherwise someone on site may need to power-cycle it or check its network connection.

A device flaps between Connected and Disconnected

Frequent short disconnects usually point to the physical layer: weak cellular signal, an undersized power supply causing brownouts, or storage problems. Check the device's system logs for undervoltage warnings and filesystem errors. Your receiver's per-device disconnect count is the fastest way to find these units before they fail outright.

The device is Connected but the TCP tunnel does not answer

  • Confirm the tunnel has been started, not just created.
  • On the device, run ss -tlnp and confirm the service is listening on the local IP and port the tunnel points at.
  • If the service listens only on a LAN address, use that address as the local target instead of 127.0.0.1.
  • Check host firewall rules on the device that might block loopback or local connections to the service.
  • Make sure you are using the current public host and port shown for that tunnel in the dashboard.

The webhook receiver receives nothing

  • Confirm the device's token is in the Token Group selected for the webhook.
  • Confirm the receiver URL in the webhook settings includes your secret path and is reachable from the internet over HTTPS.
  • If the receiver is published through a Localtonet HTTP tunnel, confirm that tunnel is running and that the machine hosting the receiver is connected.
  • Test the receiver locally with the curl example above to rule out code or path problems.

Events arrive but every device shows as unknown

The fingerprints in inventory.json do not match. Check that you hashed exactly the token or tunnel id with no trailing newline (the printf '%s' form above avoids adding one), and that Token events are matched against token fingerprints and Tunnel events against tunnel id fingerprints.

Automating fleet operations with the REST API

Everything in this guide can be managed from the dashboard, and our platform can also be managed through a REST API. At fleet scale, that is how most teams wire Localtonet into provisioning pipelines, inventory systems and maintenance tooling, for example creating and starting tunnels for a batch of devices at the start of a maintenance window and stopping them at the end, or reconciling your receiver's state against the platform's view.

We are deliberately not listing endpoints, request formats or authentication details in this article, because the exact API surface is not part of the verified material behind it, and an incorrect endpoint in a fleet script can cause real damage. Use the current reference in the Localtonet documentation hub, keep API credentials in a secrets manager, and give automation the narrowest access your workflow allows. If your team works with AI coding assistants, our Localtonet MCP Server lets assistants such as Claude Code create, start and stop tunnels directly, which can be convenient for interactive maintenance on a handful of devices. Apply the same least-privilege thinking to any tool that can change tunnel state across your fleet.

Frequently asked questions

Can Localtonet reach devices on cellular connections behind CGNAT?

The Localtonet client on the device makes an outbound connection to our relay server, so it does not need a public IP address or inbound port forwarding. As long as the device can make outbound internet connections, CGNAT on the carrier side is not an obstacle. Sites that block outbound traffic entirely would still prevent the client from connecting.

Should every device in the fleet have its own token?

Yes. Tokens are device-specific, and one token per unit is what lets you tell devices apart in webhook events, revoke a single lost device, and rotate credentials without disturbing the rest of the fleet. Inject the token per device after imaging rather than including it in a shared image.

How do I get alerted when a field device goes offline?

Configure a platform-wide webhook for the Token Group that contains your devices. When a token or tunnel changes to Connected or Disconnected, we POST a JSON body with Id, ActionDate, Type and Status to your receiver. Add a grace period in the receiver so brief reconnects do not page anyone.

Should I use TCP tunnels or VPN Manager for SSH across the fleet?

For routine operations across many devices, VPN Manager keeps management ports private and lets you control access with firewall rules. Per-device TCP tunnels are a good fit for occasional or time-limited access to specific units, such as a contractor session, and pair well with starting and stopping tunnels around maintenance windows. Many fleets use both.

Are Token/Tunnel webhooks signed like File Server webhooks?

They are separate systems. File Server webhooks support HMAC signing. Our documentation for Token/Tunnel webhooks describes the payload fields but not request signing, so protect your receiver with HTTPS and a secret URL path, and avoid triggering destructive actions from an event without confirming state independently.

Does stopping a tunnel take the device offline?

Stopping a tunnel ends that tunnel's public access. The device's client connection is a separate thing, which is why Token events and Tunnel events are reported separately. That lets you keep health monitoring active while closing access outside maintenance windows.

What should I do when a device is stolen?

Stop and delete its tunnels, revoke its token, remove it from your VPN Manager network and firewall rules, and rotate any other secrets stored on the device. Keep its fingerprint in your receiver's inventory marked as retired so any future Connected event raises an alert.

Bring your field devices under control with Localtonet

Give each device its own token, wire Connected/Disconnected events into your alerting, and choose per-device TCP tunnels or a VPN Manager mesh for access, all without touching a single site router. Start with one canary device and grow from there.

Get Started Free →

Localtonet is a secure multi-protocol tunneling and proxy platform designed to expose localhost, devices, private services, and AI agents to the public internet supporting HTTP/HTTPS tunnels, TCP/UDP forwarding, mobile proxy infrastructure, file server publishing, latency-optimized game connectivity, and developer-ready AI agent endpoint exposure from a single unified control plane.

Support