dnsd

command
Version: v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2020 License: CC0-1.0 Imports: 11 Imported by: 0

README

dnsd

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

dnsd relies on RFC 1035 zone files. This is a file that looks roughly like this:

$TTL 60
$ORIGIN pele.
@       IN     SOA     oho.pele. some@email.address. (
                       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.

Installation

Docker
$ 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 1.1.1.1: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

Testing

$ dig @127.0.0.1 google.com
$ dig @127.0.0.1 oho.pele

Support

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.

Documentation

Overview

Command dnsd is a simple DNS server for my network. It has O(n) lookup times.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to