Created
May 10, 2025 12:50
-
-
Save stianl/f1be7e3b856b1b4ac2b6cacf8673d0fa to your computer and use it in GitHub Desktop.
Show nodes and IP's of ZeroTier network
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Get the network id of the first network from the service API | |
ZT_NWID=$(curl -s -H "X-ZT1-Auth: $(cat /var/lib/zerotier-one/authtoken.secret)" http://localhost:9993/network | jq -r '.[0].nwid') | |
# Get the network members of that network - output the names | |
MEMBERS=$(curl -s -H "Accept: application/json" -H "Authorization: token $ZT_CENTRAL_API_TOKEN" "https://api.zerotier.com/api/v1/network/$ZT_NWID/member") | |
# Get the name and ips of all members | |
NAME_IPS=$(echo $MEMBERS | jq '.[]|{name: .name, ips: .config.ipAssignments}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment