Professional Documents
Culture Documents
Zerotier Openwrt
Zerotier Openwrt
目录
目录 1
Home 2
Layer 3 Routing of ZeroTier clients into an OpenWRT/LEDE LAN 2
ZeroTier setup on OpenWRT/LEDE 2
Installation 2
Create your ZeroTier network 2
Configure ZeroTier on your OpenWRT/LEDE router using UCI 2
Join your ZeroTier network with OpenWRT/LEDE 3
Configure the routing within OpenWRT/LEDE 4
Tests 5
How to compile ZeroTier using uClibc++ 5
1/6
Home
Home
Installation
If not already installed, install ZeroTier on your router. On my router a TP-Link TL-WDR4300 with lede-17.01 branch (git-17.290.79498-d3f0685) /
LEDE Reboot 17.01.4 r3560-79f57e422d I had to manually install the ZeroTier (1.1.14) package with the following commands:
ZeroTier service will autostart and join you to the public virtual network called Earth with network ID 8056c2e21c000001 . Because this is
maybe not what you want, you should stop the ZeroTier service for now:
ZeroTier Controller
-------------------
Network ID: 8ad5123ed69d6f69
IPv4 Auto-Assign (advanced)
[x] Auto-Assign from Range: 172.28.28.1-172.28.28.255
Managed Routes:
172.28.28.0/24 (LAN)
192.168.1.0/24 (172.28.28.1)
IPv6 Auto-Assign
[ ] ZeroTier RFC4193 (/128 for each device)
[ ] ZeroTier 6PLANE (/80 routable for each device)
[ ] Auto-Assign from Range
zerotier.sample_config=zerotier
zerotier.sample_config.enabled='1'
zerotier.sample_config.interface='wan'
zerotier.sample_config.join='8ad5123ed69d6f69'
zerotier.sample_config.secret='aabbccddee:0:5415e8....many...more...characters'
First we will disable the default sample_config of ZeroTier using the uci command line interface:
Then we will configure a new ZeroTier connection with name lede_network using uci
If you want to remove a network ID from the list use the following command:
Now verify that /etc/config/zerotier represents your config, mine looks like this:
As you can see, the sample_config is not enabled while lede_network is enabled.
If it looks similar on your end, reboot your router. (Yes, you must actually reboot your router here)
root@LEDE:~# reboot
After the reboot re-login using SSH and verify the zt0 interface. The interface zt0 should be up and running
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:738 (738.0 B)
After some time, your LEDE router should appear within your controller (my.zerotier.com or on your self-hosted one).
Make sure you Auth orize the client, so it can pickup an IP from your network. Because we want to later route all traffic of all members of our
ZeroTier Network ID into our LAN we make sure, that the ZeroTier IP address of our OpenWRT/LEDE router is fixed to 172.28.28.1 by setting it up
manually within the ZeroTier controller (eg. my.zerotier.com).
Hint If you change any network settings for the ZeroTier client running on your OpenWRT/LEDE router you should reboot the router, because it will
sometimes not pick up the changed configuration!
After authorization of the OpenWRT/LEDE router as a ZeroTier client and after a reboot of your router, the router should pickup the config of your
network (eg IP address) for its zt0 interface:
It is now a good time to backup the configuration of your OpenWRT/LEDE router before you continue.
Now we have to do some final setup within the web interface of the OpenWRT/LEDE router:
Go to Network->Interfaces , click on Add new interface and enter the following settings:
Then go to Network->Firewall , click on Add to create a new zone with the following settings:
Name: zero
Input: accept
Output: accept
Forward: accept
Masquerading: [ ]
MSS clamping: [ ]
Covered networks: [x] ZT0:
[ ] lan:
[ ] wan:
[ ] wan6:
4/6
How to compile ZeroTier using uClibc++
Inter-Zone Forwarding
Allow forward to destionation zones: [x] lan:
[ ] wan: wan6:
Allow forward from source zones : [x] lan:
[ ] wan: wan6:
I would now reboot the router again to make sure all the config is applied correctly.
Tests
Any ZeroTier client that now joins your ZeroTier Network (in my example: 8ad5123ed69d6f69) should automatically receive an IP address out of the
172.28.28.0/24 range while the ZeroTier client already running on your OpenWRT/LEDE router has a fixed address of 172.28.28.1 . Because of the
route we set for the ZeroTier network within the ZeroTier controller at my.zerotier.com (192.168.1.0/24 via 172.28.18.1) any of your ZeroTier
network members can now reach LAN-IPs (192.168.1.0/24) behind your OpenWRT/LEDE router. Also allo ZeroTier clients (172.28.28.0/24) can
reach each other.
Install uClibc++
wget http://cxx.uclibc.org/src/uClibc++-0.2.4.tar.bz2
tar -xvjf uClibc++-0.2.4.tar.bz2
cd uClibc++-0.2.4
make
UC_INC=~/uClibc++-0.2.4/include
UC_LIB=~/uClibc++-0.2.4/src
5/6
How to compile ZeroTier using uClibc++
6/6