# ZeroDNS

ZeroDNS is a CoreDNS-based Container that allows for name-resolution of your ZeroTier Network. Under the hood, it runs an instance of the CoreDNS server as well as a ZeroTier daemon.

## Why?

While I generally enjoy the idea of having an “internal” network for all my computers, I’m not always on the same LAN as them. Further, I strongly dislike recalling IP addresses. I found a tool that seemed to do the job, ztdns, but it lacked a “Recursive Resolver”, which made tools like nslookup very unhappy and led to downstream programs like NFS, Samba, AFP, and TimeMachine to be touch-and-go in their reliability.

Initially, I wrote a script that would periodically update my /etc/hosts file1. The catch here is that nslookup could care less about what /etc/hosts knows. It wants a DNS server, which CoreDNS seemed an apt candidate for.

Since I didn’t want to bother reconfiguring it across each machine, I wrote ZeroDNS – which synthesizes ZeroTier and CoreDNS into a container to provide a domain resolver for your ZeroTier peers.

## How’s it work?

Zerodns uses a tool called ztc to query the ZeroTier API. It then parses the returned CSV and ultimately translates it into an /etc/hosts-like file (this will be stored in your zerodns directory). This hosts file is what allows CoreDNS to reroute specific names to your peers. It locally filters your traffic looking up against the hosts file, passing all non-member queries to the DNS you specify using docker ... [[--dns <DNS>] ...].

If you’d like to further inspect functionality, you can do so here.

1. Which I actually did for a time, even with a cron job, but /etc/hosts only works for the tools that respect it, nslookup just so happens to be one that doesn’t. ↩︎