Ubuntu 23.04 bindを使って内部ネットワーク向けの設定方法

環境
# cat/etc/issue
Ubuntu 23.04 \n \l

操作方法
1.BIND をインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# apt -y install bind9 bind9utils
# apt -y install bind9 bind9utils
# apt -y install bind9 bind9utils

2.外部ネットワークには非公開の、ローカルネットワーク専用 DNS サーバーとして設定します。
ローカルネットワーク [10.0.0.0/24], ドメイン名 [cft.arkgame] の環境の場合の設定です。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# vi /etc/bind/named.conf
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
# 追記
include "/etc/bind/named.conf.internal-zones";
# vi /etc/bind/named.conf include "/etc/bind/named.conf.options"; include "/etc/bind/named.conf.local"; include "/etc/bind/named.conf.default-zones"; # 追記 include "/etc/bind/named.conf.internal-zones";
# vi /etc/bind/named.conf

include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
# 追記
include "/etc/bind/named.conf.internal-zones";

3.ローカルネットワークを定義する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# vi /etc/bind/named.conf.options
# 追加
acl internal-network {
10.0.0.0/24;
};
# 定義したローカルネットワークを追記
allow-query { localhost; internal-network; };
# ゾーン情報の転送要求を許可する範囲を追記
# セカンダリーサーバーが存在する場合は必要に応じて追加
allow-transfer { localhost; };
# 再帰的な検索を許可する
recursion yes;
//=======================================================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//=======================================================================
dnssec-validation auto;
# IPV6 を利用しない場合は [any] を [none] に変更
listen-on-v6 { none; };
# vi /etc/bind/named.conf.options # 追加 acl internal-network { 10.0.0.0/24; }; 略 # 定義したローカルネットワークを追記 allow-query { localhost; internal-network; }; # ゾーン情報の転送要求を許可する範囲を追記 # セカンダリーサーバーが存在する場合は必要に応じて追加 allow-transfer { localhost; }; # 再帰的な検索を許可する recursion yes; //======================================================================= // If BIND logs error messages about the root key being expired, // you will need to update your keys. See https://www.isc.org/bind-keys //======================================================================= dnssec-validation auto; # IPV6 を利用しない場合は [any] を [none] に変更 listen-on-v6 { none; };
# vi /etc/bind/named.conf.options

# 追加
acl internal-network {
        10.0.0.0/24;
};

略
        # 定義したローカルネットワークを追記
        allow-query { localhost; internal-network; };
        # ゾーン情報の転送要求を許可する範囲を追記
        # セカンダリーサーバーが存在する場合は必要に応じて追加
        allow-transfer { localhost; };
        # 再帰的な検索を許可する
        recursion yes;

        //=======================================================================
        // If BIND logs error messages about the root key being expired,
        // you will need to update your keys.  See https://www.isc.org/bind-keys
        //=======================================================================

        dnssec-validation auto;

        # IPV6 を利用しない場合は [any] を [none] に変更
        listen-on-v6 { none; };

4.自身のネットワークとドメイン名の定義を追記

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# vi /etc/bind/named.conf.internal-zones
zone "cft.arkgame" IN {
type master;
file "/etc/bind/cft.arkgame.lan";
allow-update { none; };
};
zone "0.0.10.in-addr.arpa" IN {
type master;
file "/etc/bind/0.0.10.db";
allow-update { none; };
};
# vi /etc/bind/named.conf.internal-zones zone "cft.arkgame" IN { type master; file "/etc/bind/cft.arkgame.lan"; allow-update { none; }; }; zone "0.0.10.in-addr.arpa" IN { type master; file "/etc/bind/0.0.10.db"; allow-update { none; }; };
# vi /etc/bind/named.conf.internal-zones

zone "cft.arkgame" IN {
        type master;
        file "/etc/bind/cft.arkgame.lan";
        allow-update { none; };
};
zone "0.0.10.in-addr.arpa" IN {
        type master;
        file "/etc/bind/0.0.10.db";
        allow-update { none; };
};

5.ローカルネットワークで IPv6 を使用していない場合は以下を追記する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# vi /etc/default/named
# 追記
OPTIONS="-u bind -4"
# vi /etc/default/named # 追記 OPTIONS="-u bind -4"
# vi /etc/default/named
# 追記
OPTIONS="-u bind -4"

 

Ubuntu 23.04

Posted by arkgame