hhoffstaette/dnsdist-utils
1
1
Fork
You've already forked dnsdist-utils
0
Extension modules for dnsdist
  • Lua 100%
Find a file
Holger Hoffstätte 1ba37faa42 Simplify IPv6 rule name generation
Append the _v6 prefix at the end of the full host entry.
This is less fragile and easier to read when inspecting the
generated dnsdist rules.
2025年07月28日 20:16:29 +02:00
hosts.lua Simplify IPv6 rule name generation 2025年07月28日 20:16:29 +02:00
LICENSE Create LICENSE 2019年12月16日 16:14:52 +01:00
README.md Add 'servers' extension for easier upstream server configuration 2024年01月04日 15:35:18 +01:00
servers.lua Add enable/disableServer functions for dynamic server control 2025年07月01日 15:18:37 +02:00
ttl.lua Make setMinTTL() safely repeatable at runtime 2024年01月04日 15:29:24 +01:00

dnsdist-utils

The awesome dnsdist DNS proxy/load balancer has almost every feature one could need for DNS, except of course the one that is useful for a small, forwarding-proxy-only home lab: exporting a central list of inhouse hosts to your own DNS, like e.g dnsmasq does by default. Lua scripting to the rescue!

Usage

  • Add the .lua files either:
    • somewhere on your default Lua module path (e.g. /usr/local/share/lua/5.1/)
    • to your /etc/dnsdist directory and edit dnsdist.conf to include the directory:
-- Add dnsdist config dir to Lua search path
package.path = package.path .. ";/etc/dnsdist/?.lua"
  • Expose entries from /etc/hosts:
require "hosts"
addHosts("/etc/hosts")
  • Block a single domain, either interactively on the console or explicitly in the config:
blockDomain("instagramm.net")
  • Block domains from a file:
blockDomains("/etc/dnsdist/blocked.conf")

The list of blocked domains is a plain file with one entry per line, e.g.:

#
# blocked domains
#
badwarez.net
facebork.net
gurgle.com
  • Extend DNS record TTLs, e.g. to set the minimum TTL for DNS responses to 3600 seconds:
require "ttl"
setMinTTL(3600)
  • Easily set common default options for upstream servers:
require "servers"
-- set default options once instead of repeating them for every server
setDefaultServerOptions({
	healthCheckMode="lazy",
	checkInterval=60,
	maxCheckFailures=2,
	lazyHealthCheckFailedInterval=60,
	lazyHealthCheckUseExponentialBackOff=true,
	lazyHealthCheckThreshold=3,
	weight=1000})
-- add server with default options
addServer({address="1.1.1.1"})
-- add server with overridden default option
addServer({address="8.8.8.8", weight=2000})

Done! Your dnsdist instance will now serve all non-localhost entries, which you can inspect on the console via showRules() or the Web UI.