banner
xingli

xingli

猫娘爱好者

Setting up a zerotier virtual LAN

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.

ZeroTier Central

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.

Untitled

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

Untitled

Important: Please allow port 9993 in the cloud server firewall and allow UDP traffic.

Verify if the node has joined#

zerotier-cli listpeers

Untitled

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.

Untitled

Untitled

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.

Untitled

After creating the network, IP range will not be assigned automatically. You need to manually click on "Easy setup" to set the IP range.

Untitled

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#

  1. Remove the zerotier-one service using dpkg.
sudo dpkg -P zerotier-one
  1. 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:#

  1. First, run the following command in the terminal to view the list of virtual networks you have joined:

    sudo zerotier-cli listnetworks
    
  2. Find the network ID of the virtual network you want to remove from the server.

  3. 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.

  4. Wait for a few seconds for the command to take effect.

  5. 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.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.