Setting up a zerotier virtual LAN#
Configuring Zerotier Moon#
Step 1: Install zerotier-one on the cloud server#
curl -s https://install.zerotier.com | sudo bash
Step 2: Cloud server joins the virtual network#
Execute the command to join the cloud server to the virtual network you have created, replacing "xxxxxxxx" with the actual virtual network ID.
The network ID can be obtained by registering an account on the official website and creating a virtual network.
sudo zerotier-cli join xxxxxxxx
If the join is successful, the terminal will return 200 join OK
.
**Success! You are ZeroTier address [ 8e0339sd57 ].
sudo zerotier-cli join 12ac4a111156fa0
sudo zerotier-cli join 53171a1111abd461 # Multiple IDs can be added simultaneously
Step 3: Configure Moon#
Go to the directory where the zerotier-one program is located, which is usually /var/lib/zerotier-one.
cd /var/lib/zerotier-one
Generate the moon.json configuration file.
sudo zerotier-idtool initmoon identity.public >> moon.json
Edit the moon.json configuration file.
sudo vim moon.json
Change the "stableEndpoints" in the configuration file to "stableEndpoints": ["ServerIP/9993"], replacing ServerIP with the public IP of the cloud server.
If the server has IPv6, modify "stableEndpoints" to the server's public IP.
"stableEndpoints": ["152.67.193.30/9993","2603:c024:b:a100::30/9993"]
Generate the .moon file.
sudo zerotier-idtool genmoon moon.json
Move the generated 000000xxxxxxxxxx.moon file to the moons.d directory.
sudo mkdir moons.d
sudo mv 000000xxxxxxxxxx.moon moons.d
The .moon configuration file is generally named with 10 leading zeros + the local node ID.
Restart the zerotier-one service.
sudo systemctl restart zerotier-one
Verify if the moon node is connected properly.
zerotier-cli listmoons
Step 4: Configure Node Orbiting Moon (Windows)#
Open the shell as an administrator and enter the following commands.
zerotier-cli.bat orbit [moon network ID] [moon network ID]
zerotier-cli.bat orbit 8e0339dc57 8e0339dc57
zerotier-cli.bat orbit e87a78aa16 e87a78aa16
Important: Please allow port 9993 in the cloud server firewall and allow UDP traffic.
Verify if the node has joined#
zerotier-cli listpeers
Check if your moon server IP is moon
This command can also be used to view connected devices and their IPs.
Setting up Plant#
First, install docker-compose and docker.
Install zerotier planet#
apt install git
git clone https://gitee.com/Jonnyan404/zerotier-planet
cd zerotier-planet
docker-compose up -d
Step 4: Allow port 4000 in the server management panel.
Initial username: admin
Initial password: mrdoc.fun
Similar to the official backend, perform network creation and other operations.
Give it a name and create a network.
After creating the network, IP range will not be assigned automatically. You need to manually click on "Easy setup" to set the IP range.
Note: This is a Zerotier Planet created using the official open-source code with some bugs, such as some devices showing offline even though they are online.
Completely uninstall ZEROTIER-ONE#
- Remove the zerotier-one service using dpkg.
sudo dpkg -P zerotier-one
- Delete the zerotier-one folder, which stores the address. After deletion, reinstalling will generate a new address.
sudo rm -rf /var/lib/zerotier-one/
Set up auto-start on boot#
systemctl enable zerotier-one
In the Linux server terminal, you can use the following command to remove a joined ZeroTier virtual network:#
-
First, run the following command in the terminal to view the list of virtual networks you have joined:
sudo zerotier-cli listnetworks
-
Find the network ID of the virtual network you want to remove from the server.
-
Run the following command to remove the virtual network from the server:
sudo zerotier-cli leave <network-ID> sudo zerotier-cli leave ba4fffb7c8e92902
where
<network-ID>
is the ID of the virtual network you want to remove from the server. -
Wait for a few seconds for the command to take effect.
-
The virtual network will be removed from the server, and you will no longer be able to connect to that network. Run
sudo zerotier-cli listnetworks
to confirm that the virtual network has been removed.