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.
How to Configure
dnsd relies on RFC 1035 zone files. This
is a file that looks roughly like this:
$TTL 60 $ORIGIN pele. @ IN SOA oho.pele. firstname.lastname@example.org. ( 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 22.214.171.124.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
FORWARD_SERVER or the command line flag
$ export DNSD_VERSION=v1.0.3 $ docker run --name dnsd -p 53:53/udp -dit --restart always xena/dnsd:$DNSD_VERSION \ dnsd -zone-url https://domain.hostname.tld/path/to/your.zone \ -zone-url https://domain.hostname.tld/path/to/adblock.zone \ -forward-server 126.96.36.199:53
From Git with systemd
$ go get -u -v github.com/Xe/x/cmd/dnsd@latest $ GOBIN=$(pwd) go install github.com/Xe/x/cmd/dnsd $ sudo cp dnsd /usr/local/bin/dnsd <edit dnsd.service as needed> $ sudo cp dnsd.service /etc/systemd/system/dnsd.service $ sudo systemctl daemon-reload $ sudo systemctl start dnsd $ sudo systemctl status dnsd $ sudo systemctl enable dnsd
$ dig @127.0.0.1 google.com $ dig @127.0.0.1 oho.pele
Thanks and be well.
Command dnsd is a simple DNS server for my network. It has O(n) lookup times.