You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Corrects a major brain-fade problem created in #595. Implements correct
IOTstack-compliant service definitions for:
* ZeroTier client
* ZeroTier router
Documentation:
* adapts YAML line numbers to new service definition
* fixes missing `/0` CIDR notation in definition of default route
* adds section on enabling full tunnelling for remote clients in
Topology 4
* adds explanation about host mode and `x-ports` syntax (an issue which
can surface if an obsolete version of docker-compose is being used).
Signed-off-by: Phill Kelley <[email protected]>
Copy file name to clipboardExpand all lines: docs/Containers/ZeroTier.md
+75-25Lines changed: 75 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -231,46 +231,46 @@ To install Zerotier-router:
231
231
232
232
2. Use a text editor to open your `docker-compose.yml`. Find the ZeroTier service definition and the environment variables it contains:
233
233
234
-
``` yaml linenums="14"
235
-
environment:
236
-
- TZ=Etc/UTC
237
-
- ZEROTIER_ONE_LOCAL_PHYS=eth0
238
-
# - ZEROTIER_ONE_NETWORK_IDS=yourNetworkID
239
-
- ZEROTIER_ONE_USE_IPTABLES_NFT=true
240
-
- ZEROTIER_ONE_GATEWAY_MODE=both
241
-
- PUID=1000
242
-
- PGID=1000
234
+
``` yaml linenums="5"
235
+
environment:
236
+
- TZ=${TZ:-Etc/UTC}
237
+
- PUID=1000
238
+
- PGID=1000
239
+
# - ZEROTIER_ONE_NETWORK_IDS=yourNetworkID
240
+
- ZEROTIER_ONE_LOCAL_PHYS=eth0 wlan0
241
+
- ZEROTIER_ONE_USE_IPTABLES_NFT=true
242
+
- ZEROTIER_ONE_GATEWAY_MODE=both
243
243
```
244
244
245
245
You should:
246
246
247
247
1. Set your timezone.
248
-
2. If necessary, change line 16 to represent your active local interfaces. Examples:
248
+
2. Uncomment line 9 and replace "yourNetworkID" with your ZeroTier Network ID. This variable only has an effect the first time ZeroTier is launched. It is an alternative to executing the following command after the container has come up the first time:
The reason for the plural variable name ("IDS") is because it supports joining multiple networks on first launch. Network IDs are space-separated, like this:
3. If necessary, change line 10 to represent your active local interfaces. Examples:
249
261
250
262
- if your Raspberry Pi only connects to WiFi, you would use:
251
263
252
-
``` yaml linenums="16"
264
+
``` yaml linenums="10"
253
265
- ZEROTIER_ONE_LOCAL_PHYS=wlan0
254
266
```
255
267
256
268
- if both Ethernet and WiFi are active, use:
257
269
258
-
``` yaml linenums="16"
270
+
``` yaml linenums="10"
259
271
- ZEROTIER_ONE_LOCAL_PHYS=eth0 wlan0
260
272
```
261
273
262
-
3. Uncomment line 17 and replace "yourNetworkID" with your ZeroTier Network ID. This variable only has an effect the first time ZeroTier is launched. It is an alternative to executing the following command after the container has come up the first time:
The reason for the plural variable name ("IDS") is because it supports joining multiple networks on first launch. Network IDs are space-separated, like this:
@@ -360,7 +360,7 @@ Enabling this feature is a two-step process:
360
360
1. In ZeroTier Central, find the "Managed Routes" area and add:
361
361
362
362
```
363
-
Destination: 0.0.0.0 (via) 10.240.0.1
363
+
Destination: 0.0.0.0/0 (via) 10.240.0.1
364
364
```
365
365
366
366
This is setting up a "default route". 10.240.0.1 is the IP address of <mark>A</mark> in the ZeroTier network.
@@ -448,6 +448,29 @@ If the second route does not make sense, think of it like this:
448
448
449
449
In essence, both these static routes are "set and forget". They assume catenet growth is a *possibility,* and that it is preferable to set up schemes that will be robust and not need constant tweaking.
450
450
451
+
### tunnelling remote clients { #topo4tunnel }
452
+
453
+
The diagram above for Topology 4 does not include a default route in ZeroTier Central. If you implement Topology 4 according to the diagram:
454
+
455
+
* traffic between <mark>G</mark> and your sites will travel via the ZeroTier Cloud (tunnelled, encrypted); but
456
+
* traffic between <mark>G</mark> and the wider Internet will not be tunnelled, will not be encrypted by ZeroTier, and will reach the Internet via the ISP or cellular carrier.
457
+
458
+
If you want remote clients like <mark>G</mark> to use full tunnelling, you can follow the same approach as for [Topology 3](#topology3). You simply need to decide which site should used by <mark>G</mark> to reach the Internet. Having made your decision, define an appropriate default route in ZeroTier Central. For example, if <mark>G</mark> should reach the Internet via:
459
+
460
+
- the left-hand site, the default route should point to the ZeroTier-router running on <mark>A</mark>:
461
+
462
+
```
463
+
Destination: 0.0.0.0/0 (via) 10.240.0.1
464
+
```
465
+
466
+
- the right-hand site, the default route should point to the ZeroTier-router running on <mark>F</mark>:
467
+
468
+
```
469
+
Destination: 0.0.0.0/0 (via) 10.240.0.2
470
+
```
471
+
472
+
Once you implement the default route, everything else is the same as for [Topology 3](#topology3).
473
+
451
474
## Managed Routes { #managedRoutes }
452
475
453
476
### TL;DR { #managedRoutesTLDR}
@@ -632,6 +655,33 @@ You would need three /23 Managed Routes in ZeroTier Central. In addition, you wo
632
655
633
656
Sure, that third octet can range from 0..255 but it's still a finite resource which is best used wisely, particularly once you start to contemplate using ZeroTier to span multiple sites.
634
657
658
+
## Host mode and ports { #hostPorts }
659
+
660
+
The default service definition for ZeroTier-router contains the following lines:
661
+
662
+
```yaml linenums="13"
663
+
network_mode: host
664
+
x-ports:
665
+
- "9993:9993"
666
+
```
667
+
668
+
Line 13 tells ZeroTier to run in Docker's "host mode". This means the processes running inside the container bind to the Raspberry Pi's network ports.
669
+
670
+
> Processes running inside non-host-mode containers bind to the container's ports, and then use Network Address Translation (NAT) to reach the Raspberry Pi's ports.
671
+
672
+
The `x-` prefix on line 14 has the effect of commenting-out the entire clause. In other words, the single `x-` has exactly the same meaning as:
673
+
674
+
``` yaml linenums="14"
675
+
# ports:
676
+
# - "9993:9993"
677
+
```
678
+
679
+
The `x-ports` clause is included to document the fact that ZeroTier uses the Raspberry Pi's port 9993.
680
+
681
+
> Documenting the ports in use for host-mode containers helps IOTstack's maintainers avoid port conflicts when adding new containers.
682
+
683
+
You should **not** remove the `x-` prefix. If docker-compose complains about the `x-ports` clause, the message is actually telling you that your copy of docker-compose is obsolete and that you should upgrade.
0 commit comments