Create a private zerotier controller and customize the root server (ztncui) as the Moon node

ZeroTier One's own servers are accessed slowly abroad. The problem of slow connection can be solved by setting up a domestic Moon service.
However, a server with a fixed external IP address is required, and can be registered sanfengyun Apply for a free ECS account.


Zerotier defines several technical terms and advantages
#You can see these nouns when you use the zerotier cli listpeers command. The machine that acts as the moon should have a public IP address
PLANET: PLANET server, the root server of Zerotier, including Japan, Singapore, etc
Moon: a satellite level server, a private root server built by the user, which plays the role of transit acceleration
LEAF: equivalent to each branch, that is, each machine node connected to the network

#Zerotier one advantage
1: the control end (ZeroTier official website) is powerful enough to issue routing tables, admission control, IP allocation, traffic rules, etc,
2: a transit server (Moon server) can be established to achieve better link effect
3: close to free. Individual users can access up to 100 node devices,
4: client open source. You can compile it yourself

Build an open source Moon satellite transit node

#ztncui depends on zerotier, so you need to install zerotier first
    curl -s | sudo bash
#Install ztncui software and start
    yum install -y
    yum install ztncui -y
    echo "HTTPS_PORT = 3443" > /opt/key-networks/ztncui/.env

    systemctl restart ztncui

#web login ztncui console
    Account: admin
    Password: password

#Configure the native as a moon node
    #Enter the configuration file directory of zerotier one
    cd /var/lib/zerotier-one
    #Generate moon JSON
    zerotier-idtool initmoon identity.public >> moon.json

    vi /var/lib/zerotier-one/moon.json
    #Change this line to
    "stableEndpoints": [ "main engine ip1/9993","main engine ip2/9993" ]

    #Generate A signature file. This command will generate A signature file in the current directory, such as 000000deadbeef00 Moon (the id of machine A is deadbeef00)
    zerotier-idtool genmoon moon.json

    #Close selinux


#(note) for usage and other systems, please refer to ztncui's community documents

Zerotier one client installation

#Installing zerotier one on linux
    curl -s | sudo bash

#If linux is used as a local forwarding gateway, selinux needs to be turned off

#Join the network
    zerotier-cli join xxxxxxxx

How zerotier one customers add custom Moon nodes

#Method 1:
    zerotier-cli orbit deaxx22 deaxx22

#Method 2:
    On the client's zerotier-one Configuring directories, creating moons.d  And will Moon Nodal/var/lib/zerotier-one/000000deadbeef00.moon Copy the file to the moons.d Directory

    #linux directory /var/lib/zerotier-one/
        mkdir /var/lib/zerotier-one/moons.d/
    #windows directory C:\ProgramData\ZeroTier\One
    #FreeBSD/OpenBSD Directory: /var/db/zerotier-one

    scp root@ /var/lib/zerotier-one/moons.d/
    zerotier-cli orbit 106a05fxxc 106a05fxxc

    #If the client acts as a local forwarding gateway, SNAT needs to be set and enabled. Kernel forwarding
        #echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
        #sysctl -p
        #iptables -t nat -A POSTROUTING -s -o br-lan -j SNAT --to-source

Zerotier one client operation help

#Client directory path
    cd /var/lib/zerotier-one

#Restart client
    systemctl restart zerotier-one

#Zerotier cli usage guide
    zerotier-cli info           #View current zerotier one information
    zerotier-cli listpeers          #List all peers
    zerotier-cli listnetworks       #List all networks joined
    zerotier-cli join <network>     #Join a network
    zerotier-cli leave <network>        #Leave a network
    zerotier-cli listmoons          #List joined Moon nodes
    zerotier-cli orbit <world ID> <seed>    #Join a Moon node
    zerotier-cli deorbit <world ID>     #Leave a Moon node

Article reprint link:

Tags: security

Posted by phpusr on Mon, 30 May 2022 01:47:16 +0530