Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZeroTier hangs in controller mode #26

Closed
boschkundendienst opened this issue Jan 20, 2018 · 5 comments
Closed

ZeroTier hangs in controller mode #26

boschkundendienst opened this issue Jan 20, 2018 · 5 comments

Comments

@boschkundendienst
Copy link
Collaborator

Just to mention, that the problem I am running into (after configuring controller ZeroTier will hang on restart) is discussed here and it looks like they fixed it somehow with a patch or removing one (f4feccc6).

Is this fix in your version of ZeroTier?
ZeroTier hangs in controller mode #553

@mwarning
Copy link
Owner

I've added the patch. But have not tested it yet.

@boschkundendienst
Copy link
Collaborator Author

I would like to test it, but I am not very good at compiling stuff. Is there a way to get it as package for my router. I am running https://downloads.lede-project.org/releases/17.01.4/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-tl-wdr4300-v1-squashfs-factory.bin with ZeroTier zerotier - 1.2.4-2

@mwarning
Copy link
Owner

mwarning commented Jan 22, 2018

@boschkundendienst try http://mwarning.de/misc/zerotier_1.2.4-2_mips_24kc.ipk

Please check if this packages zt is not affected by the controller bug.

@boschkundendienst
Copy link
Collaborator Author

@mwarning It seems to work - good job

I did a quick check by installing your package, setting a config, starting ZeroTier and created a dumb controller. It seems restarting ZeroTier now works if a controller configuration is present. - Nice!

Info

root@OpenWrt:/tmp# cat /etc/os-release | grep "B[OU][IA][LR]D"
BUILD_ID="r5932-9c4fe10"
LEDE_BOARD="ar71xx/generic"
root@OpenWrt:/tmp# uname -a
Linux OpenWrt 4.9.77 #0 Mon Jan 22 12:41:20 2018 mips GNU/Linux

Installing ZeroTier

root@OpenWrt:~# opkg update
root@OpenWrt:~# cd /tmp
root@OpenWrt:/tmp# wget "http://mwarning.de/misc/zerotier_1.2.4-2_mips_24kc.ipk"
...
root@OpenWrt:/tmp# opkg install ./zerotier_1.2.4-2_mips_24kc.ipk
Installing zerotier (1.2.4-2) to root...
Installing libstdcpp (5.5.0-1) to root...
Downloading .../snapshots/targets/ar71xx/generic/packages/libstdcpp_5.5.0-1_mips_24kc.ipk
Installing kmod-tun (4.9.77-1) to root...
Downloading .../snapshots/targets/ar71xx/generic/packages/kmod-tun_4.9.77-1_mips_24kc.ipk
Installing libminiupnpc (2.0.20170509-1) to root...
Downloading .../snapshots/packages/mips_24kc/packages/libminiupnpc_2.0.20170509-1_mips_24kc.ipk
Installing libnatpmp (20140401-1) to root...
Downloading .../snapshots/packages/mips_24kc/packages/libnatpmp_20140401-1_mips_24kc.ipk
Configuring kmod-tun.
Configuring libstdcpp.
Configuring libminiupnpc.
Configuring libnatpmp.
Configuring zerotier.

Configure ZeroTier via uci

root@OpenWrt:/tmp# 
root@OpenWrt:/tmp# 
root@OpenWrt:/tmp# uci set zerotier.sample_config.config_path='/zerotier'
root@OpenWrt:/tmp# uci set zerotier.sample_config.enabled='1'
root@OpenWrt:/tmp# uci commit zerotier

create config folder in filesystem (not tmpfs) and start ZeroTier

root@OpenWrt:/tmp# mkdir /zerotier
root@OpenWrt:/tmp# /etc/init.d/zerotier start
Generate secret - please wait...

Check if ZeroTier is running

root@OpenWrt:/tmp# ifconfig zt0
zt0       Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet addr:xxx.xxx.xxx.xxx  Bcast:29.255.255.255  Mask:254.0.0.0
          inet6 addr: xxxx:xxxx:xxxx:xxxx:xxx:xxxx:xxxx:xxxx/xx Scope:Global
          inet6 addr: xxxx::xxxx:xxxx:xxxx:xxxx/xx Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:2800  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:1116 (1.0 KiB)

Check if custom configuration path is used

root@OpenWrt:/tmp# ls -l /zerotier/
-rw-------    1 root     root            24 Jan 23 07:14 authtoken.secret
drwx------    2 root     root             0 Jan 23 07:14 controller.d
-rw-r--r--    1 root     root            21 Jan 23 07:14 devicemap
drwxr-xr-x    2 root     root             0 Jan 23 07:15 iddb.d
-rw-r--r--    1 root     root           141 Jan 23 07:14 identity.public
-rw-r--r--    1 root     root           271 Jan 23 07:14 identity.secret
drwxr-xr-x    2 root     root             0 Jan 23 07:14 networks.d
-rw-r--r--    1 root     root           634 Jan 23 07:14 planet
-rw-r--r--    1 root     root             4 Jan 23 07:14 zerotier-one.pid
-rw-r--r--    1 root     root             4 Jan 23 07:14 zerotier-one.port

Create dumb controller

root@OpenWrt:/tmp# opkg install curl
...
root@OpenWrt:/tmp# zerotierfolder=/zerotier
root@OpenWrt:/tmp# secret=$(cat /zerotier/authtoken.secret)
root@OpenWrt:/tmp# mynetworkname=ledecontrollertest
root@OpenWrt:/tmp# clientid=$(zerotier-cli info | awk '{print $3}')
root@OpenWrt:/tmp# nwidbase="$clientid""______"
root@OpenWrt:/tmp# baseurl=http://127.0.0.1:9993
root@OpenWrt:/tmp#   curl \
     -s \
     -X POST \
     -H "X-ZT1-Auth: $secret" \
     -H "Content-Type: application/json" \
     -d " { \"name\":\"$mynetworkname\" }" \
     $baseurl/controller/network/$nwidbase
{
 "activeMemberCount": 0,
 "authTokens": [],
 "authorizedMemberCount": 0,
 "capabilities": [],
 "clock": 1516692058757,
 "creationTime": 1516692058757,
 "enableBroadcast": true,
 "id": "351ac3914a7ce907",
 "ipAssignmentPools": [],
 "lastModified": 1516692058757,
 "multicastLimit": 32,
 "name": "ledecontrollertest",
 "nwid": "351ac3914a7ce907",
 "objtype": "network",
 "private": true,
 "revision": 1,
 "routes": [],
 "rules": [
  {
   "not": false,
   "or": false,
   "type": "ACTION_ACCEPT"
  }
 ],
 "tags": [],
 "totalMemberCount": 0,
 "v4AssignMode": {
  "zt": false
 },
 "v6AssignMode": {
  "6plane": false,
  "rfc4193": false,
  "zt": false
 }

look for controller specific files in configuration folder

root@OpenWrt:/tmp# find /zerotier/controller.d/
/zerotier/controller.d/
/zerotier/controller.d/network
/zerotier/controller.d/network/351ac3914a7ce907.json

stop ZeroTier

root@OpenWrt:/tmp# /etc/init.d/zerotier stop
root@OpenWrt:/tmp# ps w | grep zerotier | grep -v "grep"
root@OpenWrt:/tmp# 

start ZeroTier again

root@OpenWrt:/tmp# /etc/init.d/zerotier start
root@OpenWrt:/tmp# 
root@OpenWrt:/tmp# ifconfig zt0
zt0       Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet addr:xxx.xxx.xxx.xxx  Bcast:29.255.255.255  Mask:254.0.0.0
          inet6 addr: xxxx:xxxx:xxxx:xxxx:xxx:xxxx:xxxx:xxxx/xx Scope:Global
          inet6 addr: xxxx::xxxx:xxxx:xxxx:xxxx/xx Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:2800  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:1006 (1006.0 B)

@mwarning
Copy link
Owner

ok, great. I will submit the changes to github.com/openwrt/packages then.
Thank you for the thorough testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants