CentOS7でbind install (bind-9.9.4)

更新日 2018-03-25 (日) 17:26:18

SELINUXを無効

  • 確認
# /usr/sbin/getenforce
Enforcing
#  vi /etc/selinux/config
SELINUX=disabled

ファイアウォールで53/udp許可

# systemctl start firewalld
# firewall-cmd --zone=public --add-port=53/udp
success
# firewall-cmd --zone=public --add-port=53/udp --permanent
success
# systemctl enable named
Created symlink from /etc/systemd/system/multi-user.target.wants/named.service to /usr/lib/systemd/system/named.service.

設定

# yum install named
  • /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.
//
// See the BIND Administrator's Reference Manual (ARM) for details about the
// configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html

options {
        listen-on port 53 {
                  any;     ← any変更
        };
        ## listen-on-v6 port 53 { ::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; XXX.XXX.42.16/28; 192.168.31.0/24;};
	 allow-query     {any;};

        /*
         - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
         - If you are building a RECURSIVE (caching) DNS server, you need to enable
           recursion.
         - If your recursive DNS server has a public IP address, you MUST enable access
           control to limit queries to your legitimate users. Failing to do so will
           cause your server to become part of large scale DNS amplification
           attacks. Implementing BCP38 within your network would greatly
           reduce such attack surface
        */
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic"; 

        pid-file "/run/named/named.pid";
        session-keyfile "/run/named/session.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

//以降は追加

view "internal" {
        match-clients {
                localhost;
                XXX.XXX.42.16/28;
                192.168.31.0/24;
        };
        zone "." IN {
                type hint;
                file "named.ca";
        };
        zone "YYYY.XXXX.net" IN {
                type master;
                file "named.host";
                allow-update { none; };
        };
        zone "XXX/28.XXX.uuu.zzz.in-addr.arpa" IN {
                type master;
                file "named.rev";
                allow-update { none; };
        };

        zone "0.0.127.in-addr.arpa" {
                type master;
                file "named.loopback";
        };
 

// include "/etc/named.rfc1912.zones";    ←コメントアウト
include "/etc/named.root.key";
};

view "external" {
        match-clients { any; };
        allow-query { any; };
        recursion no;
        zone "YYYY.XXXX.net" IN {
                type master;
                file "named.host";
                allow-update { none; };
        };
        zone "XXX/28.XXX.uuu.zzz.in-addr.arpa" IN {
                type master;
                file "named.rev";
                allow-update { none; };
        };
        zone "0.0.127.in-addr.arpa" {
                type master;
                file "named.loopback";
        };
};
  • /var/named/named.host
$TTL 1D
@       IN SOA  open.YYYY-XXXX.net. root.open.YYYY-XXXX.net. (
                                        2       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        A       127.0.0.1
;        AAAA    ::1
@       A       XXX.XXX.42.17

plesk10         IN A     XXX.XXX.42.19
                IN MX    5 plesk10.YYYY.XXXX.net.
gw              IN A     XXX.XXX.42.20
                IN MX    5 gw.YYYY.XXXX.net.
ism             IN A     XXX.XXX.42.21
                IN MX    5 ism.YYYY.XXXX.net.
fnavi           IN A     XXX.XXX.42.22
                IN MX    5 fnavi.YYYY.XXXX.net.
my-disk         IN A     XXX.XXX.42.23
                IN MX    5 my-disk.YYYY.XXXX.net.
manabi          IN A     XXX.XXX.42.24
               IN MX    5 manabi.YYYY.XXXX.net.
gw2             IN A     XXX.XXX.42.25
                IN MX    5 gw2.YYYY.XXXX.net.
gw3             IN A     XXX.XXX.42.26
                IN MX    5 gw3.YYYY.XXXX.net.
xenserver       IN A     XXX.XXX.42.27
                IN MX    5 xenserver.YYYY.XXXX.net.
xenserver2      IN A     XXX.XXX.42.28
                IN MX    5 xenserver2.YYYY.XXXX.net.
ar415s          IN A     XXX.XXX.42.29
                IN MX    5 ar415s.YYYY.XXXX.net.
  • /var/named/named.rev
;
; open.YYYY-XXXX.net  /var/named/named.rev
;
$TTL 1D
@ IN    SOA     open.YYYY-XXXX.net. root.open.YYYY-XXXX.net. (
                1               ; Serial
                10800           ; Refresh
                1800            ; Retry
                3600000         ; Expire
                86400 )         ; Minimum
        NS      open.YYYY-XXXX.net.
;        NS      ns01.mctv.ne.jp.
17       PTR     open.YYYY-XXXX.net.

named.loopbackとnamed.caはデフォルトのまま使用

named.rfc1912.zonesファイル 初期設定ファイルでインクルードされている設定ファイル。 RFC1912で定められたDNSサーバとして必要な最小限のDNSレコードを設定するための設定ファイル。 基本的に変更することはない。

named.root.key 初期設定ファイルでインクルードされている設定ファイル。 rootサーバのDNSSEC鍵情報が記述されている。 これも基本的に変更しない。


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2018-03-25 (日) 17:26:18 (599d)