A custom DNS server for my network. DNS zone files are dynamically downloaded on startup and are continuously monitored for changes. When the DNS zone is changed, the service reloads it.
I primarily use this to give myself a limited form of piHole DNS adblocking, as well as serving my home network services.
This is related to my WireGuard Site to Site VPN project.
dnsd
relies on RFC 1035 zone files. This
is a file that looks roughly like this:
$TTL 60
$ORIGIN pele.
@ IN SOA oho.pele. [email protected]. (
2019040601 ; serial number YYYYMMDDNN
28800 ; Refresh
7200 ; Retry
864000 ; Expire
60 ; Minimum DNS TTL
)
IN NS oho.pele.
oho IN A 10.55.0.1
1.0.55.10.in-addr.arpa. IN PTR oho.pele.
;; apps
prometheus IN CNAME oho.pele.
grafana IN CNAME oho.pele.
Put this file in a publicly available place and then set its URL as a
-zone-file
in the command line configuration. This file will be monitored
every minute for changes (via the proxy of the ETag of the HTTP responses).
If you need to change the DNS forwarding server, set the value of the environment
variable FORWARD_SERVER
or the command line flag -forward-server
.
$ docker run --name dnsd -p 53:53/udp -dit --restart always xena/dnsd:v1.0.3 \
dnsd -zone-url https://xena.greedo.xeserv.us/files/adblock.zone \
-forward-server 1.1.1.1:53
$ dig @127.0.0.1 google.com
$ dig @127.0.0.1 oho.pele
If you need help with this, please contact me. This is fairly simplistic software. If you need anything more, I'd suggest using CoreDNS or similar.
If you like this software, please consider donating on Patreon or Ko-Fi. I use this software daily on my personal network to service most of my devices.
Thanks and be well.