LUA module to run dnsdist in a quick way.
Your configuration is composed of the following parts with YAML format:
services
: DNS services to start (DNS, DoH, DoT)admin
: Enables the console, web API and morerules
: Defines how to handle your DNS traffic
See the complete configuration file for all options.
- Copy
dnsdist_ootb.lua
and the folderdnsdist_ootb
in yourdnsdist
configuration folder (the default is/etc/dnsdist
) - Update your
dnsdist.conf
with the following code to import the LUA module.
-- Import module and load the YAML config
dnsdistpath = "/etc/dnsdist/"
package.path = dnsdistpath .. package.path
dnsdist_ootb = require "dnsdist_ootb"
dnsdist_ootb.loadConfig{file=dnsdistpath .. "dnsdist.yml"}
Create a new configuration file /etc/dnsdist/dnsdist.yml
file and copy the content of the minimal configuration example to start dnsdist like a Forwarding and Caching DNS Server
to a pool of DNS public servers.
# Basic Forwarding and Caching DNS Server to a pool of public DNS server
# load balancing of the outgoing traffic to a pool of dns servers in round robin
rules:
- upstreams:
dns:
- ip: 8.8.8.8
- ip: 9.9.9.9
- ip: 1.1.1.1
- Use case 1: Forward to a pool of DNS public servers
- Use case 2: Forward to a pool of DOH public servers
- Use case 3: Ads/tracking/malware domains blocking before to forward
- Use case 4: Split between corporate and external DNS
- Use case 5: Traffic remote logging per rule
-
Create the folder
conf
with the following content- conf/
- dnsdist_ootb/
- dnsdist_ootb.lua
- dnsdist.conf
- dnsdist.yml
- conf/
-
Import the module for the docker image like this
-- Import module
dnsdistpath = "/etc/dnsdist/conf.d/"
package.path = dnsdistpath .. package.path
dnsdist_ootb = require "dnsdist_ootb"
dnsdist_ootb.loadConfig{file = dnsdistpath .. "dnsdist.yml"}
-
Configure your
dnsdist.yml
config file -
Then mount the folder as a volume
sudo docker run -d -p 53:53/udp -p 53:53/tcp --restart unless-stopped --name=dnsdist \
--volume=$PWD/conf/:/etc/dnsdist/conf.d/ powerdns/dnsdist-17:1.7.2