DNSサーバ構築
CENTOS+BINDで構築した。
参考ページ
http://www.server-world.info/query?os=CentOS_6&p=dns&f=1
DNSサーバのIP:192.168.29.200 DNSサーバ名:dlp.gouriki.com ドメイン:gouriki.com
1.BINDインストール
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
[root@dlp ~]# yum -y install bind bind-utils
2.BINDの設定
 ̄ ̄ ̄ ̄ ̄ ̄ ̄
[root@dlp ~]# echo 'OPTIONS="-4"' >> /etc/sysconfig/named # IPv6を使わない場合は設定 ( 使うなら設定しない )
/etc/named.conf を以下のように編集した。
// // named.conf // // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS // server as a caching only nameserver (as a localhost DNS resolver only). // // See /usr/share/doc/bind*/sample/ for example named configuration files. // options { listen-on port 53 { any; }; // listen-on port 53 { 127.0.0.1; }; // listen-on-v6 { none; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; // 問い合わせを許可する範囲 ( 内部ネットワーク等を指定 ) allow-query { localhost; 192.168.29.0/24; }; // ゾーン情報の転送を許可する範囲 ( セカンダリDNSがいればその場所/範囲 ) allow-transfer { localhost; 192.168.29.0/24; }; recursion yes; dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto; /* Path to ISC DLV key */ bindkeys-file "/etc/named.iscdlv.key"; managed-keys-directory "/var/named/dynamic"; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; //zone "." IN { // // type hint; // file "named.ca"; //}; view "internall" { match-clients { localhost; 192.168.29.0/24; }; zone "." IN { type hint; file "named.ca"; }; include "/etc/named.rfc1912.zones"; include "/etc/named.root.key"; zone "gouriki.com" IN { type master; file "gouriki.com.lan"; allow-update { none; }; }; zone "29.168.192.in-addr.arpa" IN { type master; file "29.168.192.db"; allow-update { none; }; }; };
3.内部向け正引き情報の設定ファイル作成
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
/var/named/gouriki.com.lan を以下のように作成。
$TTL 86400 @ IN SOA dlp.gouriki.com. root.gouriki.com. ( 2014080201 ;Serial 3600 ;Refresh 1800 ;Retry 604800 ;Expire 86400 ;Minimum TTL ) IN NS dlp.gouriki.com. IN A 192.168.29.200 IN MX 10 dlp.gouriki.com. dlp IN A 192.168.29.200
4.内部向け逆引き情報の設定ファイル作成
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
/var/named/29.168.192.db を以下のように作成。
$TTL 86400 @ IN SOA dlp.gouriki.com. root.gouriki.com. ( 2014080201 ;Serial 3600 ;Refresh 1800 ;Retry 604800 ;Expire 86400 ;Minimum TTL ) IN NS dlp.gouriki.com. IN PTR gouriki.com. IN A 255.255.255.0 200 IN PTR dlp.gouriki.com.
5.BINDの起動
 ̄ ̄ ̄ ̄ ̄ ̄ ̄
[root@dlp ~]# /etc/rc.d/init.d/named start Starting named: [ OK ] [root@dlp ~]# chkconfig named on ↑起動スクリプトに追加している
6.名前解決の参照先を変更
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
[root@dlp ~]#
vi /etc/sysconfig/network-scripts/ifcfg-eth0
# 自ホストに変更
DNS1=192.168.29.200 [root@dlp ~]# /etc/rc.d/init.d/network restart
7.正常に名前解決ができるかどうかの動作確認
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
[root@centos64 mnt]# dig dlp.gouriki.com ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> dlp.gouriki.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17542 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;dlp.gouriki.com. IN A ;; ANSWER SECTION: dlp.gouriki.com. 86400 IN A 192.168.29.200 ;; AUTHORITY SECTION: gouriki.com. 86400 IN NS dlp.gouriki.com. ;; Query time: 1 msec ;; SERVER: 192.168.29.200#53(192.168.29.200) ;; WHEN: Thu Jan 22 20:29:40 2015 ;; MSG SIZE rcvd: 63
[root@centos64 mnt]# dig -x 192.168.29.200 ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> -x 192.168.29.200 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13263 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;200.29.168.192.in-addr.arpa. IN PTR ;; ANSWER SECTION: 200.29.168.192.in-addr.arpa. 86400 IN PTR dlp.gouriki.com. ;; AUTHORITY SECTION: 29.168.192.in-addr.arpa. 86400 IN NS dlp.gouriki.com. ;; ADDITIONAL SECTION: dlp.gouriki.com. 86400 IN A 192.168.29.200 ;; Query time: 0 msec ;; SERVER: 192.168.29.200#53(192.168.29.200) ;; WHEN: Thu Jan 22 20:29:47 2015 ;; MSG SIZE rcvd: 104