【PowerDns】安裝 https://doc.powerdns.com/recursor/getting-started.html#debian-based-distributions 關閉 systemd-resolved,讓出 port 53 sudo systemctl stop systemd-resolved sudo systemctl disable systemd-resolved install pdns-recursor # 安裝 powerdns recursor apt-get install pdns-recursor  # 尋找版本 # pdns_recursor --version root@dockr204:/etc/powerdns# pdns_recursor --version Aug 08 17:34:07 PowerDNS Recursor 4.6.0 (C) 2001-2021 PowerDNS.COM BV Aug 08 17:34:07 Using 64-bits mode. Built using gcc 11.2.0. Aug 08 17:34:07 PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it according to the terms of the GPL version 2. 設定資料夾在  /etc/powerdns root@dockr204:/etc/powerdns# ll /etc/powerdns total 76 drwxr-xr-x 3 root root 4096 Aug 8 17:31 ./ drwxr-xr-x 104 root root 4096 Aug 8 17:24 ../ -rw-r--r-- 1 root root 58718 Mar 12 2022 recursor.conf drwxr-xr-x 2 root root 4096 Mar 12 2022 recursor.d/ -rw-r--r-- 1 root root 272 Mar 12 2022 recursor.lua # ll /etc/powerdns/recursor.d total 8 drwxr-xr-x 2 root root 4096 Mar 12 2022 ./ drwxr-xr-x 3 root root 4096 Aug 8 17:31 ../ # cat recursor.lua -- Debian default Lua configuration file for PowerDNS Recursor -- Load DNSSEC root keys from dns-root-data package. -- Note: If you provide your own Lua configuration file, consider -- running rootkeys.lua too. dofile("/usr/share/pdns-recursor/lua-config/rootkeys.lua") # cat recursor.conf | grep -v "#" | grep -v "^$" config-dir=/etc/powerdns hint-file=/usr/share/dns/root.hints include-dir=/etc/powerdns/recursor.d local-address=127.0.0.1 lua-config-file=/etc/powerdns/recursor.lua public-suffix-list-file=/usr/share/publicsuffix/public_suffix_list.dat quiet=yes security-poll-suffix= 備份預設檔,建立新的設定檔 sudo systemctl disable systemd-resolved sudo systemctl stop systemd-resolved 修改 recursor.conf api-key=AAAABBBDDDCCC webserver=yes webserver-port=8082 webserver-address=0.0.0.0 webserver-allow-from=0.0.0.0/0 allow-from=127.0.0.1, 192.168.0.0/24 # 查 abc.com.tw 的交給本地 Authoritative Server(UDP 54) forward-zones=abc.com.tw=127.0.0.1:54 # 其他一律轉外部解析 forward-zones-recurse=.=8.8.8.8, .=168.95.1.1 local-address=0.0.0.0 local-port=53 setgid=pdns setuid=pdns logging-facility=0 max-negative-ttl=3600 quiet=yes # 其他設定 config-dir=/etc/powerdns hint-file=/usr/share/dns/root.hints include-dir=/etc/powerdns/recursor.d lua-config-file=/etc/powerdns/recursor.lua 設定自動啟動及重啟 PowerDNS-Recursor 服務 systemctl start pdns-recursor systemctl enable pdns-recursor # 安裝權威伺服器 # 安裝權威伺服器 sudo apt-get install pdns-server 備份預設檔,建立新的設定檔 mv /etc/powerdns/pdns.conf /etc/powerdns/pdns.conf.bak vim /etc/powerdns/pdns.conf