LoginSignup
0
0

More than 5 years have passed since last update.

スレーブ DNS サーバーの構築方法

Last updated at Posted at 2018-05-06

BIND で スレーブ DNS サーバーを構築する方法です。
IP アドレス 133.130.100.15 にスレーブ DNS サーバーを立てます。
マスターは、160.16.10.150 とします。
そのうち、example01.jp と example02.jp をミラーする例です。

1)マスター DNS サーバーで、転送を許可する
 >/etc/named.conf を編集
 allow-transfer { 133.130.100.15; };

編集後、サーバーを再起動

sudo systemctl restart named

2)スレーブ DNS サーバーの設定

/etc/named.conf を編集
allow-notify {
160.16.10.150;
};

zone "example01.jp" {
type slave;
allow-query { any; };
masters { 160.16.10.150; };
file "/var/named/slaves/example01.jp.bak";
};

zone "example02.jp" {
type slave;
allow-query { any; };
masters { 160.16.10.150; };
file "/var/named/slaves/example02.jp.bak";
};

編集後、サーバーを再起動

sudo systemctl restart named
次のファイルが作成されます。
/var/named/slaves/example01.jp.bak
/var/named/slaves/example02.jp.bak

/etc/named.conf
// vim:set ts=4 sw=4 et:

options {
    listen-on port 53 { 127.0.0.1;};
listen-on-v6 port 53 { ::1; };
    directory "/var/named";
    pid-file "/run/named/named.pid";

    // Uncomment these to enable IPv6 connections support
    // IPv4 will still work:
    //  listen-on-v6 { any; };
    // Add this for no IPv4:
    //  listen-on { none; };

    allow-query { none; };
    allow-recursion { none; };
    allow-transfer { none; };
    allow-update { none; };

allow-notify { 160.16.10.150; };

recursion no;

    version none;
    hostname none;
    server-id none;
};

zone "localhost" IN {
    type master;
    file "localhost.zone";
};

zone "0.0.127.in-addr.arpa" IN {
    type master;
    file "127.0.0.zone";
};

zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" {
    type master;
    file "localhost.ip6.zone";
};

zone "255.in-addr.arpa" IN {
    type master;
    file "empty.zone";
};

zone "0.in-addr.arpa" IN {
    type master;
    file "empty.zone";
};

zone "." IN {
    type hint;
    file "root.hint";
};

zone "example01.jp" {
    type slave;
    allow-query { any; };
    masters { 160.16.10.150; };
    file "/var/named/slaves/example01.jp.bak";
    };

zone "example02.jp" {
    type slave;
    allow-query { any; };
    masters { 160.16.10.150; };
    file "/var/named/slaves/example02.jp.bak";
    };

3) スレーブサーバーの動作確認

dig example01.jp @133.130.100.15
dig example02.jp @133.130.100.15

マスターへの問い合わせと同じ結果が得られるか確認

dig example01.jp @160.16.10.150
dig example02.jp @160.16.10.150
0
0
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
0
0