Skip to content

Instantly share code, notes, and snippets.

View laduke's full-sized avatar

Travis LaDuke laduke

  • zerotier
  • California
View GitHub Profile
@laduke
laduke / members-list-csv.sh
Last active July 6, 2023 18:26
zerotier central members list as csv
curl --silent --header "authorization: bearer ${TOKEN}" "https://my.zerotier.com/api/network/${NWID}/member" | jq ".[] | [ .nodeId, .name, .config.ipAssignments[0] ]" | jq -rs ".[] | @csv"
@laduke
laduke / network-via-fs.md
Last active December 17, 2020 17:39
zerotier network join via fs

Typically, you use zerotier-cli to join and leave networks, but you can also write files to the filesystem to do this.

The networks.d subdirectory of the ZeroTier working directory keeps track of which networks are joined and their settings.

The ZeroTier working directory can be found...

  • On Windows: \ProgramData\ZeroTier\One
  • On Mac: /Library/Application Support/ZeroTier/One
  • On Linux: /var/lib/zerotier-one
@laduke
laduke / zerotier-cli-completion.bash
Created July 7, 2020 20:56
bash completion for zerotier-cli
#compdef zerotier-cli
#autoload
_get_network_ids ()
{
if [[ "$OSTYPE" == "darwin"* ]]; then
COMPREPLY=($(compgen -W "$(ls -1 /Library/Application\ Support/ZeroTier/One/networks.d | cut -c 1-16)" -- ${cur}))
else
COMPREPLY=($(compgen -W "$(ls -1 /var/lib/zerotier-one/networks.d | cut -c 1-16)" -- ${cur}))
@laduke
laduke / machine.js
Last active September 19, 2019 23:15
Generated by XState Viz: https://xstate.js.org/viz
const myMachine = Machine({
type: 'parallel',
context: {},
states: {
hi: {
initial: 'no',
states: {
yes: {},
no: { on: { CLICK_ME: 'yes' } }
@laduke
laduke / zerotier-troubleshoot.md
Last active December 17, 2020 17:39
zerotier-troubleshoot.sh

Collect information helpful for troubleshooting zerotier-one

Run this on Mac or Linux

It will create a text file in the current directory. It won't modify anything.

Make sure you are root

   (set -x; \
 zerotier-cli info -j; \
function h(tag, as, xs) {
var attrs = Object.entries(as).map(([k, v]) => ` ${k}="${v}"`);
return `<${tag}${attrs}>${xs.join("")}</${tag}>`;
}
console.log(
h("div", { id: "foo" }, [
h("p", { class: "big" }, ["hi", h("p", {}, ["3"])]),
h("p", {}, ["bye"])
@laduke
laduke / controller.org
Created February 25, 2019 18:41
controller.org

Set up a controller with curl

1 Find your auth token

the authtoken.secret file

  • On Mac this is in “/Library/Application Support/ZeroTier/One”. also, the installer copies it to ~/Library/Application\ Support/ZeroTier/One
  • Windows this is usually in “\ProgramData\ZeroTier\One”. also, the installer copies it somewhere local to the installing user… I forget
  • On Linux this is usually in “/var/lib/zerotier-one”.
@laduke
laduke / ztv6.md
Last active September 23, 2023 15:53
ZeroTier 6PLANE and RFC4193 address calculation

ZeroTier IPv6 Auto-Assign Addresses

https://www.zerotier.com/manual.shtml#2_2_3

  • A network ID is 16 hex digits (9bee8941b5de0691)
  • A node ID is 10 hex digits (1234512345)

ZeroTier RFC4193 (/128 for each device)

  • fd9b:ee89:41b5:de06:9199:9312:3451:2345

ZeroTier 6PLANE (/80 routable for each device)

Find your auth token

the authtoken.secret file

  • On Mac this is in "/Library/Application Support/ZeroTier/One". also, the installer copies it to ~/Library/Application
    Support/ZeroTier/One
  • Windows this is usually in "\ProgramData\ZeroTier\One". also, the installer copies it somewhere local to the installing user... I