- 下载地址
http://members.home.nl/p.a.rombouts/pdnsd/dl.html
- 下载安装
wget http://members.home.nl/p.a.rombouts/pdnsd/releases/pdnsd-1.2.9a-par_sl6.x86_64.rpm
rpm -ivh pdnsd-1.2.9a-par_sl6.x86_64.rpm
- 生成示例文件为:
/etc/pdnsd.conf.sample
- 复制为pdnsd.conf
cp /etc/pdnsd.conf.sample /etc/pdnsd.conf
- 修改配置文件:
监听ip修改为0.0.0.0
-
修改端口
global {
perm_cache=1024;
cache_dir="/var/cache/pdnsd";
run_as="pdnsd";
server_ip = eth0; // Use eth0 here if you want to allow other
// machines on your network to query pdnsd.
status_ctl = on;
paranoid=on;
query_method=tcp_only; // pdnsd must be compiled with tcp
// query support for this to work.
min_ttl=1d; // Retain cached entries at least 15 minutes.
max_ttl=1w; // One week.
timeout=10; // Global timeout option (10 seconds).
// Don't enable if you don't recurse yourself, can lead to problems
// delegation_only="com","net";
}
/* with status_ctl=on and resolvconf installed, this will work out from the box
this is the recommended setup for mobile machines /
// This section is meant for resolving from root servers.
server {
label = "root-servers";
root_server=on;
ip = 8.8.8.8,208.67.222.222,208.67.220.220;
timeout = 5;
uptest = query;
interval = 30m; // Test every half hour.
ping_timeout = 300; // 30 seconds.
purge_cache = off;
exclude = .localdomain;
policy = included;
preset = off;
}
source {
owner=localhost;
// serve_aliases=on;
file="/etc/hosts";
}
rr
/
neg {
name=doubleclick.net;
types=domain; // This will also block xxx.doubleclick.net, etc.
}
/
/
neg {
name=bad.server.com; // Badly behaved server you don't want to connect to.
types=A,AAAA;
}
*/ -
启动服务
/etc/init.d/pdnsd restart
- dig 示例
dig -p 20053 @xxx.izhong.me facebook.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.4 <<>> -p 20053 @hz6p.izhong.me facebook.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14405
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;facebook.com. IN A
;; ANSWER SECTION:
facebook.com. 600 IN A 31.13.65.1
;; Query time: 484 msec
;; SERVER: 10.252.144.80#20053(10.252.144.80)
;; WHEN: Thu Sep 24 20:45:22 2015
;; MSG SIZE rcvd: 46