Skip to content

ZeroTier overlay networks on Ubuntu

How to install ZeroTier, join a network, and shape the rules engine — the install we run when clients need an Ethernet-style overlay with central administration.

ZeroTier sells itself as “an Ethernet switch in the cloud” — clients running the agent join a virtual L2 network and talk as if they shared a switch. We pick it over Tailscale when a workload genuinely needs broadcast/multicast or a non-IP protocol; otherwise the answer is usually Tailscale. This article covers the install, the join, and how to write flow rules that do not leak.

How to verify

Before installing, confirm UDP 9993 is reachable outbound (ZeroTier’s default), the kernel exposes /dev/net/tun, and no leftover ZeroTier service is half-installed.

ss -unp | grep :9993
ls -l /dev/net/tun
dpkg -l | grep zerotier
sysctl net.ipv4.ip_forward

If /dev/net/tun is missing — common on stripped-down LXC containers — modprobe tun and add tun to /etc/modules. Without it the agent will install but never bring up the ztXXXXXX interface.

What’s happening

ZeroTier has two parts:

  • Planet/controller — the public ZeroTier Central (or your self-hosted controller). It holds network membership, flow rules, and IP assignments. Clients fetch this and renew leases.
  • Earth nodes — each device runs zerotier-one, gets a 10-character node ID, and joins networks by their 16-character network ID.

The data plane is peer-to-peer UDP with hole-punching, falling back to ZeroTier’s “root” relays when NAT prevents direct connection. The result, from the kernel’s point of view, is a regular ztXXXXXX interface with an IP from the network’s managed pool. Broadcast frames work; multicast works; ARP works; non-IP protocols pass.

Flow rules are the difference between a flat L2 and a useful overlay. They are written in ZeroTier’s small DSL (drop, accept, tee, redirect, with match clauses for source/dest, port, tags) and applied centrally — every node enforces the same ruleset.

The procedure

  1. Install on Ubuntu. Use the official one-liner only after auditing the signing chain; the apt source is the safer path for fleet installs.

    curl -fsSL https://raw.githubusercontent.com/zerotier/ZeroTierOne/main/doc/contact%40zerotier.com.gpg | \
      gpg --dearmor -o /usr/share/keyrings/zerotierone-archive-keyring.gpg
    echo "deb [signed-by=/usr/share/keyrings/zerotierone-archive-keyring.gpg] \
      http://download.zerotier.com/debian/jammy jammy main" > /etc/apt/sources.list.d/zerotier.list
    apt update
    apt install -y zerotier-one
    systemctl enable --now zerotier-one
  2. Note the node ID. This is the device’s identity.

    zerotier-cli info
    # 200 info abcdef1234 1.12.2 ONLINE
  3. Create a network in ZeroTier Central (or in your self-hosted controller). Note the 16-character network ID. Pick the IP pool (e.g. 10.144.0.0/16) and decide whether auto-assign is on.

  4. Join from the host.

    zerotier-cli join 0123456789abcdef
    zerotier-cli listnetworks
    # The status will be REQUESTING_CONFIGURATION until you authorize.
  5. Authorize the member. In Central, tick the “Auth” box next to the node ID — until you do, the agent stays in ACCESS_DENIED. For fleet installs, drive this via the API.

    curl -s -H "Authorization: token <central-api-token>" \
      -X POST "https://api.zerotier.com/api/v1/network/0123456789abcdef/member/abcdef1234" \
      -d '{"config":{"authorized":true}}'
  6. Write flow rules. The default network is “wide open.” A starter rule set that mirrors what most clients actually want — only authorized members talk, only on the ports you list, log dropped traffic:

    # Allow IPv4 ARP and broadcast.
    accept ethertype 0x0806;
    accept ethertype 0x86dd; # IPv6
    # Allow ICMP within the overlay.
    accept ipprotocol icmp;
    # Allow only listed app traffic.
    accept ipprotocol tcp and dport 22 or dport 443 or dport 5432;
    # Drop the rest, tee a notice to the controller.
    tee 8 0 not ipprotocol tcp;
    drop;

    Save in Central and the rules push to every member within a minute.

  7. Confirm the interface and routes.

    ip addr show | grep zt
    ip route show | grep 10.144
    ping -c 3 10.144.0.5

Common pitfalls

  • Forgetting to authorize the member — the agent will sit at REQUESTING_CONFIGURATION forever and you will assume the network is broken.
  • Leaving the flow rules at default (accept;) — every host is wide open to every other host, including non-IP protocols you did not intend to expose.
  • Running ZeroTier on a host that already has an overlapping subnet (e.g. Docker’s 172.17.0.0/16) — packets get the wrong route and you spend hours wondering why ping fails one way.
  • Using the public planet without a backup plan — outages of ZeroTier’s central infrastructure are rare but real; if uptime is critical, run your own controller (zerotier-one --controller) and a self-hosted moon.
  • Naming members by hostname only — when a host is reimaged the new node ID is unauthorized by default. Tag members in Central so identity follows the workload.

In the engagements we run, ZeroTier is a fit for legacy LAN-shaped applications that genuinely need L2 — industrial PLCs, certain HPC frameworks, file shares with broadcast discovery. Where IP-only routing is enough, we lean to Tailscale or WireGuard. The Managed Operations view is the same regardless of the engine: who is on the network, why, and what happens when the controller goes dark.