How to reset ZeroTier moon node

ZeroTier Installation

ZeroTier provides a script that detects your OS, adds the correct GPG keys and repositories, and installs the package for you.

# Install curl (if missing):
sudo apt update && sudo apt install curl -y
# Run the install script:
curl -s https://install.zerotier.com | sudo bash
# Check Status:
sudo zerotier-cli status
# Enable on Boot:
sudo systemctl enable zerotier-one

Deorbit obsolete Moon Node

To check if your client is connected to a Moon node and to remove it (“de-orbit”), follow these steps.

sudo zerotier-cli listpeers

What to look for:
Scan the Role column in the output.

  • PLANET: These are the official ZeroTier root servers.
  • LEAF: These are regular peers (other computers in your network).
  • MOON: This is your Moon node.
# Run the deorbit command:
# (Replace deadbeef00 with the 10-character ID you saw in the check step above)
sudo zerotier-cli deorbit deadbeef00

# Verify
# (The Role for that ID should either disappear from the list entirely or change from MOON back to LEAF (if it is also a regular member of your network)
sudo zerotier-cli listpeers

Setting up Moon Node

Setting up a ZeroTier “Moon” node allows you to create your own user-defined root server. This helps reduce latency and adds redundancy if your connection to the official ZeroTier root servers is slow or unstable.

Here is the step-by-step guide to setting up a Moon node on a Linux server.

Prerequisites

  • A Linux server (Ubuntu, Debian, CentOS, etc.)
  • static IP address (publicly accessible if your clients are over the internet; internal if strictly for LAN).
  • Port 9993/UDP allowed through your server’s firewall.

Firewall Rules

Ensure your cloud provider (AWS, DigitalOcean, etc.) and your OS firewall (ufw or iptables) allow traffic on UDP port 9993. If this port is blocked, clients will not be able to orbit the moon.

Step 1: Generate the Moon Configuration

SSH into your server and switch to the ZeroTier directory.

1、Navigate to the ZeroTier home directory:

    cd /var/lib/zerotier-one

    2、Generate the configuration file:
    Use your node’s current identity to create a template JSON file.

    sudo zerotier-idtool initmoon identity.public >> moon.json

    Step 2: Edit the Configuration

    You must tell the Moon node what its own valid IP address is so other clients can find it.

    1、Open moon.json with a text editor:

    sudo vim moon.json

    2、Find the stableEndpoints section.
    It will likely look like “stableEndpoints”: []. Change it to include your server’s IP address and the ZeroTier port (default is 9993).

    Example: (Replace 203.0.113.10 with your server's actual static IP).
    "roots": [
      {
        "identity": "YOUR_IDENTITY_STRING_HERE",
        "stableEndpoints": [ "203.0.113.10:9993" ]
      }
    ],

    3、Save and exit

    Step 3: Sign and Create the Moon File

    Now you need to cryptographically sign the configuration to create the actual .moon file.

    1、Run the generation command:

    sudo zerotier-idtool genmoon moon.json

    2、Identify the new file:
    This will create a file named something like 000000deadbeef00.moon.

    The deadbeef00 part (the last 10 characters) is your Moon ID.

    Write this ID down, you will need it to connect clients.

    Step 4: Install the Moon on the Server

    For the server to act as a Moon, it must “install” this file into its own configuration folder.

    1、Create the moons directory:

      sudo mkdir moons.d

      2、Move the signed file:

      sudo mv 000000*.moon moons.d/

      3、Restart the ZeroTier service:

      sudo systemctl restart zerotier-one

      Connect Clients (Orbit)

      To use this Moon node, your other devices (clients) need to “orbit” it.

      Run the following command on your client devices:

      sudo zerotier-cli orbit <Moon_ID> <Moon_ID>
      • Note: You usually type the ID twice. The first argument is the “World ID” (the moon), and the second is the “Root ID” (the specific server acting as the moon). In a single-server setup, these are identical.
      • Example: If your file was 000000deadbeef00.moon, the ID is deadbeef00.
      sudo zerotier-cli orbit deadbeef00 deadbeef00

      Verification

      To verify that your client is using the Moon node:

      Run the list peers command:

      sudo zerotier-cli listpeers

      Look for your Moon’s ID in the list. Under the “Role” column, it should say MOON instead of LEAF.

      Leave a Reply

      Your email address will not be published. Required fields are marked *