4
6

More than 5 years have passed since last update.

PowerDNS recursorが内向きDNSサーバで設定一番簡単

Last updated at Posted at 2014-06-18

インストール

1. インストール

インストール
$ sudo apt-get install -y pdns-recursor
macの場合
$ brew install pdnsrec
# 設定ファイルは /usr/local/etc/powerdns/recursor.conf

2. 設定

PowerDNS Authoritative Serverで再帰問い合わせを有効にする。 — ペンギンと愉快な機械の日々が詳しい。

/etc/powerdns/recursor.conf
+export-etc-hosts=on # /etc/hosts をDNS登録する。
-local-address=127.0.0.1
+local-address=0.0.0.0 # 他のサーバからも問い合わせられるようにする。
+recursor=8.8.8.8 # DNS再帰問い合わせ先
IPアドレス帯に応じて以下も修正する。
allow-from=127.0.0.0/8, 10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, ::1/128, fe80::/10

3. restart

$ sudo /etc/init.d/pdns-recursor restart

問い合わせ

  • 192.168.0.52がpdns-recursorが稼働しているサーバとする。

/etc/resolv.confを修正

pdns-recursorが稼働しているサーバの場合
search local
nameserver 127.0.0.1
その他のサーバの場合
search local
nameserver 192.168.0.52

他のサーバから動作確認

192.168.0.52の/etc/hostsの内容が問い合わせられることを確認。
$ nslookup
> dnssv
Server:     192.168.0.52
Address:    192.168.0.52#53

Non-authoritative answer:
Name:   dnssv.local
Address: 192.168.0.52
> 192.168.0.52
Server:     192.168.0.52
Address:    192.168.0.52#53

Non-authoritative answer:
52.0.168.192.in-addr.arpa   name = dnssv.
52.0.168.192.in-addr.arpa   name = dnssv.local.

Authoritative answers can be found from:
/etc/hosts以外のも問い合わせられることを確認。
$ nslookup
> google.co.jp
Server:     192.168.0.52
Address:    192.168.0.52#53

Non-authoritative answer:
Name:   google.co.jp
Address: 173.194.126.239
Name:   google.co.jp
Address: 173.194.126.247
Name:   google.co.jp
Address: 173.194.126.248

/etc/hosts修正の反映

リスタートすればよい
$ sudo /etc/init.d/pdns-recursor restart
4
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
6