SmartDNS

An open-source DNS server with intelligent caching and configurable upstream querying strategies.

SmartDNS will measure latency for each answer received from upstream servers and cache the fastest route, giving your users a much better internet experience

Getting Started

Installation

Automatic Installation

$ curl https://proxetas.com/installers/smartdns.sh | sh

Manual Installation

1. Download the tarball

$ curl -O https://proxetas.com/downloads/smartdns.tar.gz

2. Extract the contents to /etc/smart-dns

$ sudo mkdir -p /etc/smartdns
$ sudo tar -xzfc smartdns.tar.gz /etc/smartdns

3. Copy

$ sudo cp /etc/smart-dns/smartdns.service /etc/systemd/system/smartdns.service

4. Reload daemons and enable the smartdns service

$ sudo systemctl daemon-reload
$ sudo systemctl enable smartdns

5. After you’ve updated /etc/smart-dns/config.yml, start the service

$ sudo systemctl start smartdns

Configuration

Modify the config.yml file according to your needs.

$ sudo nano /etc/smart-dns/config.yml
server:
  port: 53
  address: 0.0.0.0
nameservers:
  - 1.1.1.1
  - 8.8.8.8
  - 192.168.0.1
  - 192.168.18.1
addresses:
  override-some-website.com: 10.0.0.2
queries:
  recache_ttl: 10
  upstream_strategy: parallel

Server Block

port is the udp port the server will listen for queries on

address is the address the server will bind to

Nameservers Block

An array of upstream dns servers to forward queries to. Queries will be forwarded according to upstream_strategy

Addresses Block

Map of overrides for queries. ie. If you’d like to redirect specific domain names to specific addresses.

Queries Block

recache_tll time before expiration to recache & optimize records. The user will be sent the cached/optimized record, while the server requires upstream nameservers.

ie. If a cached response has 10 seconds till expiration and recache_ttl is set to 5, the server will continue as normal.

However, once time till expiration is 5 seconds, and a query for the record comes in: first the user will be sent the cached/optimized record, after which the server will query upstream servers to recache, reoptimize records.