I have been using Zerotier to network all of my computers for a little while now. I discovered it when I wanted to play video games remotely using Moonlight. It is a very useful networking tool that is easy to use, easy to manage, and runs on every kind of computer/os combination I have available to me.
It basicaly works by creating a virtual LAN network that interconnects machines you join to your private or public network. I am currently using it in my Personal Cloud Setup as well as to manage my DigitalOcean Droplet that runs my website and various other projects like the moonlight api
My network has been growing. I have added several Raspberry Pi computers and continued to set up Zerotier on other machines I use. I have been managing the network name resolution manually with my hostfile and my ssh config files, but with so many machines on my private network now that was getting tedious. They were never in sync and they are always changing as I add and remove machine from my Zerotier private network.
So I decided the other day to figure out this problem.
I manage my domain name via AWS Route53. I have a single hosted zone for this domina name. I knew AWS had great SDKs for almost every programming language so no problem there.
Zerotier also has an API that you can use to get information about your networks and network members.
The basic gist of the code is this:
- Grab a list of Zerotier network members names and IP addresses
- Grab a list of existing DNS records from Route53
- Filter the DNS records in some way so we are only looking at Zerotier related DNS records
- Compare the lists with each other and either create or delete records based on what was added or deleted or changed
- Rinse, Repeat...
The only real question was how to classify the records in Route53 as Zerotier related records. I decided to use
<membername>.zt.example.com using the
.zt. to filter. This seems to be working well.
This little project did not take very long and I am very happy with the results. I am now able to
And access my machines anywhere. They are obviously not publically accessible but any member machine of my network can get to any of the others with zero configuration.