Contents
- 1 BINDについて
- 2 サーバー構築
- 3 BINDの構築
- 4 BIND設定
- 4.1 設定サンプル
- 4.2 named.conf
- 4.2.1 記法
- 4.2.2 標準設定一覧
- 4.2.3 設定項目
- 4.2.3.1 ACLステートメント
- 4.2.3.2 CONTROLSステートメント
- 4.2.3.3 DLZステートメント
- 4.2.3.4 DYNDBステートメント
- 4.2.3.5 KEYステートメント
- 4.2.3.6 LOGGINGステートメント
- 4.2.3.7 LWRESステートメント
- 4.2.3.8 MANAGED-KEYSステートメント
- 4.2.3.9 MASTERSステートメント
- 4.2.3.10 KEYステートメント
- 4.2.3.11 LOGGINGステートメント
- 4.2.3.12 LWRESステートメント
- 4.2.3.13 MANAGED-KEYSステートメント
- 4.2.3.14 MASTERSステートメント
- 4.2.3.15 OPTIONSステートメント
- 4.2.3.16 SERVERステートメント
- 4.2.3.17 STATISTICS-CHANNELSステートメント
- 4.2.3.18 TRUSTED-KEYSステートメント
- 4.2.3.19 VIEWステートメント
- 4.2.3.20 ZONEステートメント
- 5 インストールプログラム
- 5.1 通常プログラム
- 5.2 管理プログラム
- 5.2.1 ddns-confgen
- 5.2.2 dnssec-dsfromkey
- 5.2.3 dnssec-importkey
- 5.2.4 dnssec-keyfromlabel
- 5.2.5 dnssec-keygen
- 5.2.6 dnssec-revoke
- 5.2.7 dnssec-settime
- 5.2.8 dnssec-signzone
- 5.2.9 dnssec-verify
- 5.2.10 genrandom
- 5.2.11 isc-hmac-fixup
- 5.2.12 lwresd
- 5.2.13 named
- 5.2.14 named-checkconf
- 5.2.15 named-checkzone
- 5.2.16 named-compilezone
- 5.2.17 named-journalprint
- 5.2.18 nsec3hash
- 5.2.19 rndc
- 5.2.20 rndc-confgen
- 5.2.21 tsig-keygen
- 6 運用
BINDについて
公式ページ:https://www.isc.org/downloads/bind/
用語
コンテンツサーバ
自サイトのドメインを管理し、問い合わせに対して応答するサーバ
キャッシングサーバ
自サイトのクライアントの代理としてドメイン名の解決をするサーバ。
解決結果はキャッシュされることからこの名前で呼ばれる。
フォワーディングサーバやフルサービスリゾルバとも呼ばれることがある。
フォワーディングサーバ
ドメイン名の解決をするが、一定の場合は問い合わせを転送して結果を問い合わせ元に返すキャッシングサーバのこと。
フルサービスリゾルバ
問い合わせを転送することなく、単独で全てのドメイン名の問い合わせを行うことができるキャッシングサーバのこと。
機能
RNDCユーティリティ
- 参考
RNDCとはRemote Name Daemon Controlの略で、リモートからBINDを管理するツールのことである。
通常BINDはローカルからもRNDCを使用して管理する。
サーバー構築
構築環境
- BIND
9.11.3
※パッケージ版は9.9.4
- OS
CentOS 7.3
OS設定
ネットワーク
固定IPアドレス割り当て
次のファイルを編集する
# ifcfg-loはループバックインタフェースであるため、触らない vi /etc/sysconfig/network-scripts/ifcfg-<インタフェース名>
以下では例として192.168.0.51/24を割り当てた
BOOTPROTO=static ONBOOT=yes IPADDR=192.168.0.51 NETMASK=255.255.255.0 NETWORK=192.168.0.0 GATEWAY=192.168.0.1
ネットワークを再起動する
systemctl restart network
ip addressコマンドにより、インタフェースが有効になっていることを確認する
これによりホストマシンなどからSSHでログイン可能となる
firewalld
DNS
DNS(TCP/53、UDP/53)を開ける場合、下記を行う。
※CentOS7.2以前のCentOS7場合はfirewalldのバージョン場古く、下記を実行できない。アップデートすること。
yum update firewalld -y
- ルールが定義されていることを確認
firewall-cmd --permanent --info-service=dns
- 現在ルールが適用されていないことを確認する
firewall-cmd --list-services --zone=public --permanent | sed -e "s/ /\n/g" | grep dns
- ルールを適用する
firewall-cmd --add-service=dns --zone=public --permanent
- ルールが適用されていることを確認する
firewall-cmd --list-services --zone=public --permanent | sed -e "s/ /\n/g" | grep dns
- firewalldシステムを再起動して設定を反映させる
systemctl restart firewalld
RNDC
BINDのリモート管理用のポート(TCP/953)を開ける場合、下記を行う。
ローカルからのみ管理する場合は不要である。
- 現在ルールが定義されていないか確認
firewall-cmd --permanent --info-service=rndc
- 新しいルールを定義
firewall-cmd --new-service=rndc --permanent firewall-cmd --service=rndc --add-port=953/tcp --permanent
- ルールが定義されていることを確認
firewall-cmd --permanent --info-service=rndc
- 現在ルールが適用されていないことを確認する
firewall-cmd --list-services --zone=public --permanent | sed -e "s/ /\n/g" | grep rndc
- ルールを適用する
firewall-cmd --add-service=rndc --zone=public --permanent
- ルールが適用されていることを確認する
firewall-cmd --list-services --zone=public --permanent | sed -e "s/ /\n/g" | grep rndc
- 設定を再読み込みして反映させる
firewall-cmd --reload
ホスト名
ホスト名としてdnsを設定する
hostname dns.corp # 再起動しても有効にする echo dns.corp > /etc/hostname再ログインすることで有効になる。
ユーザ作成
BIND用のユーザを作成する
useradd --user-group --no-create-home --shell /sbin/false bind
関連ソフトウェアのインストール
OpenSSL
wget http://www.openssl.org/source/openssl-1.0.0d.tar.gz tar xzvf openssl-1.0.0d.tar.gz cd openssl-* ./config --prefix=/usr/local/`pwd | sed "s/.*\///"` --openssldir=/usr/local/`pwd | sed "s/.*\///"` -fPIC make make install cd ../
BINDの構築
インストールに関するドキュメント:https://ftp.isc.org/isc/bind9/cur/9.9/doc/arm/Bv9ARM.ch12.html#id-1.13.2.6
BINDのインストール
パッケージからインストール
[root@dns ~]# yum install bind -y Loaded plugins: fastestmirror base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 packages-microsoft-com-mssql-server-2017 | 2.9 kB 00:00:00 packages-microsoft-com-prod | 2.9 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/4): extras/7/x86_64/primary_db | 181 kB 00:00:00 (2/4): packages-microsoft-com-mssql-server-2017/primary_db | 9.9 kB 00:00:00 (3/4): packages-microsoft-com-prod/primary_db | 69 kB 00:00:00 (4/4): updates/7/x86_64/primary_db | 6.9 MB 00:00:01 Determining fastest mirrors * base: centos.usonyx.net * extras: ftp.iij.ad.jp * updates: centos.usonyx.net Resolving Dependencies --> Running transaction check ---> Package bind.x86_64 32:9.9.4-51.el7_4.2 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================== ======================== Package Arch Version Repositor Size
y===================================================================================================== =======================
=Installing:
bind x86_64 32:9.9.4-51.el7_4.2 updates 1.8 M Transaction Summary ===================================================================================================== ========================Install 1 Package
Total download size: 1.8 M Installed size: 4.3 M Downloading packages: bind-9.9.4-51.el7_4.2.x86_64.rpm | 1.8 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 32:bind-9.9.4-51.el7_4.2.x86_64 1/1 Verifying : 32:bind-9.9.4-51.el7_4.2.x86_64 1/1 Installed: bind.x86_64 32:9.9.4-51.el7_4.2 Complete!
ソースコードからインストール
- rootになる
su -
- 関連パッケージをインストールする
まとめてインストールする場合
yum install gcc openssl-devel -y
- コンパイラをインストールする
yum install gcc -y
- opensslのビルドセットをインストールする
yum install openssl-devel -y
- コンパイラをインストールする
- ソースコードを取得する
- ダウンロードサイト:https://www.isc.org/downloads/からBINDの「Current-Stable」版のアーカイブのURLを取得する
- ダウンロードする
curl -O -s https://www.isc.org/downloads/file/bind-9-11-3/?version=tar-gz
- ダウンロードしたファイルをリネームする
mv \?version\=tar-gz bind-9.11.3.tar.gz
- アーカイブファイルを展開する
tar xzfv bind-*.tar.gz
- ソースコードディレクトリへ移動する
cd bind-*
- コンパイル、インストールを行う
- コンパイル最適化設定を行う
export CFLAGS="-O3 -m64"
- Makefileを生成する
./configure --prefix=/usr/local/`pwd | sed "s/.*\///"` --oldincludedir=/usr/local/`pwd | sed "s/.*\///"`/include --without-openssl 2>&1 | tee configure.log
- オプション一覧
[root@dns bind-9.11.3]# ./configure --help `configure' configures BIND 9.11 to adapt to many kinds of systems. Usage: ./configure [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print `checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for `--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or `..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, `make install' will install all the files in `/usr/local/bin', `/usr/local/lib' etc. You can specify an installation prefix other than `/usr/local' using `--prefix', for instance `--prefix=$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/bind] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] NOTE: If PREFIX is not set, then the default values for --sysconfdir and --localstatedir are /etc and /var, respectively. System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-libbind deprecated --enable-buffer-useinline define ISC_BUFFER_USEINLINE when compiling [[default=yes]] --enable-warn-shadow turn on -Wshadow when compiling --enable-warn-error turn on -Werror when compiling --enable-developer enable developer build settings --enable-afl enable American Fuzzy Lop test harness [default=no] --enable-seccomp enable support for libseccomp system call filtering [default=no] --enable-kqueue use BSD kqueue when available [default=yes] --enable-epoll use Linux epoll when available [default=auto] --enable-devpoll use /dev/poll when available [default=yes] --enable-threads enable multithreading --enable-native-pkcs11 use native PKCS11 for all crypto [default=no] --enable-openssl-hash use OpenSSL for hash functions [default=no] --enable-openssl-version-check check OpenSSL version [default=yes] --enable-largefile 64-bit file support --enable-backtrace log stack backtrace on abort [default=yes] --enable-symtable use internal symbol table for backtrace [all|minimal(default)|none] --enable-ipv6 use IPv6 [default=autodetect] --disable-tcp-fastopen disable TCP Fast Open support [default=autodetect] --enable-getifaddrs enable the use of getifaddrs() [yes|no]. --disable-isc-spnego use SPNEGO from GSSAPI library --disable-chroot disable chroot --disable-linux-caps disable linux capabilities --enable-atomic enable machine specific atomic operations [default=autodetect] --enable-fixed-rrset enable fixed rrset ordering [default=no] --disable-rpz-nsip disable rpz nsip rules [default=enabled] --disable-rpz-nsdname disable rpz nsdname rules [default=enabled] --enable-filter-aaaa enable filtering of AAAA records [default=no] --enable-dnstap enable dnstap support (requires fstrm, protobuf-c) --enable-querytrace enable very verbose query trace logging [default=no] --enable-full-report report values of all configure options Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-python=PATH specify path to python interpreter --with-python-install-dir=PATH installation directory for Python modules --with-geoip=PATH Build with GeoIP support (yes|no|path) --with-gssapi=PATH|/path/krb5-config Specify path for system-supplied GSSAPI [default=yes] --with-randomdev=PATH Specify path for random device --with-locktype=ARG Specify mutex lock type (adaptive or standard) --with-libtool use GNU libtool --with-openssl=PATH Build with OpenSSL [yes|no|path]. (Crypto is required for DNSSEC) --with-pkcs11=PATH Build with PKCS11 support [yes|no|path] (PATH is for the PKCS11 provider) --with-ecdsa Crypto ECDSA --with-gost Crypto GOST [yes|no|raw|asn1]. --with-eddsa Crypto EDDSA [yes|all|no]. --with-aes Crypto AES --with-cc-alg=ALG choose the algorithm for Client Cookie [aes|sha1|sha256] --with-lmdb=PATH build with LMDB library [yes|no|path] --with-libxml2=PATH build with libxml2 library [yes|no|path] --with-libjson=PATH build with libjson0 library [yes|no|path] --with-zlib=PATH build with zlib for HTTP compression [default=yes] --with-purify=PATH use Rational purify --with-gperftools-profiler use gperftools CPU profiler --with-kame=PATH use Kame IPv6 [default path /usr/local/v6] --with-readline=LIBSPEC specify readline library [default auto] --with-protobuf-c=path Path where protobuf-c is installed, for dnstap --with-libfstrm=path Path where libfstrm is installed, for dnstap --with-docbook-xsl=PATH specify path for Docbook-XSL stylesheets --with-idn=MPREFIX enable IDN support using idnkit [default PREFIX] --with-libiconv=IPREFIX GNU libiconv are in IPREFIX [default PREFIX] --with-iconv=LIBSPEC specify iconv library [default -liconv] --with-idnlib=ARG specify libidnkit --with-atf support Automated Test Framework --with-tuning=ARG Specify server tuning (large or default) --with-dlopen=ARG support dynamically loadable DLZ drivers --with-dlz-postgres=PATH Build with Postgres DLZ driver [yes|no|path]. (Required to use Postgres with DLZ) --with-dlz-mysql=PATH Build with MySQL DLZ driver [yes|no|path]. (Required to use MySQL with DLZ) --with-dlz-bdb=PATH Build with Berkeley DB DLZ driver [yes|no|path]. (Required to use Berkeley DB with DLZ) --with-dlz-filesystem=ARG Build with filesystem DLZ driver [yes|no]. (Required to use file system driver with DLZ) --with-dlz-ldap=PATH Build with LDAP DLZ driver [yes|no|path]. (Required to use LDAP with DLZ) --with-dlz-odbc=PATH Build with ODBC DLZ driver [yes|no|path]. (Required to use ODBC with DLZ) --with-dlz-stub=ARG Build with stub DLZ driver [yes|no]. (Required to use stub driver with DLZ) --with-make-clean run "make clean" at end of configure [yes|no] Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir> LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Professional support for BIND is provided by Internet Systems Consortium, Inc. Information about paid support and training options is available at
Technical support for open source BIND 9 DNS, Kea DHCP and ISC DHCP software
Help can also often be found on the BIND Users mailing list (https://lists.isc.org/mailman/listinfo/bind-users) or in the #bind channel of the Freenode IRC service. Report bugs to <info@isc.org>. BIND home page: <https://www.isc.org/downloads/BIND/>. - オプション
- –without-openssl
OpenSSLを使用しない。OpenSSLを使用しないと暗号化をサポートしなくなる。
デフォルトではOpenSSLを使用するので、事前にインストールしておく必要がある。
- –without-openssl
- オプション一覧
- コンパイルする
make 2>&1 | tee make.log
- インストールを行う。
make install 2>&1 | tee make_install.log
- コンパイル最適化設定を行う
- リンク作成、環境変数設定などを行う
- インストールディレクトリへのシンボリックリンクを作成する。
これによって、複数のバージョンを同居させ、リンクを切り替えることで、バージョン変更が可能となる。
各バージョンの実行ファイルはデフォルトでは各バージョンの設定ファイルを読み込むこととなる。
rm -f /usr/local/bind ln -s /usr/local/`pwd | sed "s/.*\///"` /usr/local/bind
- 簡単にアクセスできるように環境変数を設定する
export BIND_HOME=/usr/local/bind
- ツール類にパスを通す
export PATH=$BIND_HOME/bin:$BIND_HOME/sbin:$PATH
- 環境変数を再起動後も有効にする
echo "" >> /etc/bashrc echo "# BIND ENVIRONMENT VARIABLE" >> /etc/bashrc echo "export BIND_HOME=$BIND_HOME" >> /etc/bashrc echo "export PATH=\$BIND_HOME/bin:\$BIND_HOME/sbin:\$PATH" >> /etc/bashrc
- 実行できることを確認する
named -v # バージョン情報が出力される
- インストールディレクトリへのシンボリックリンクを作成する。
- 設定サンプルファイルを使用する場合、コピーする。(基本的には不要)
cp bin/tests/named.conf $BIND_HOME/etc/
- 不要なソースコードを削除する
cd ../ rm -rf bind*
- systemdの設定する
- サービスファイルを作成する
※1024番以下のポートを使用する場合はパラメータ”User”を使用し、root以外を指定してはならない。
cat > /etc/systemd/system/bind.service << EOT [Unit] Description=BIND DNS name server After=local-fs.target network.target network-online.target [Service] Type=forking ExecStart=/usr/local/bind/sbin/named -u bind -t /usr/local/bind/ -c etc/named.conf -L log/named.log ExecReload=/usr/local/bind/sbin/rndc reload ExecStop=/usr/local/bind/sbin/rndc stop PrivateTmp=true NonBlocking=yes [Install] WantedBy=multi-user.target EOT
- 必要であれば、ソケットファイルも作成する。
ソケットファイルはスーパーデーモンを利用する際に使用する。
DNSを使用する頻度が低いなら設定しておくと良い。
cat > /etc/systemd/system/bind.socket << EOT [Unit] Description=BIND DNS name server activation socket [Socket] BINDIPv6Only=ipv6-only ListenStream=0.0.0.0:53 ListenStream=[::]:53 KeepAlive=true [Install] WantedBy=sockets.target EOT
- 作成したファイルを反映する
systemctl daemon-reload
- サービスを有効化する
systemctl enable bind
- サービスが有効化されていることを確認する
systemctl list-unit-files --type service --no-pager | grep bind
- サービスファイルを作成する
- インストールしたディレクトリに移動する
cd $BIND_HOME
- 設定確認コマンドを修正する
設定確認コマンド(sbin/named-checkconf)はchrootを行う場合は都度オプションが必要である。
また、chrootを行う場合、変更された基底ディレクトリから設定ファイルを参照できるように指定する必要がある。
これは毎回行うと手間なので、スクリプトを作成して毎回指定できるようにする。
mv sbin/named-checkconf sbin/named-checkconf.original echo "$BIND_HOME/sbin/named-checkconf.original -t $BIND_HOME etc/named.conf \$*" > sbin/named-checkconf chmod 555 sbin/named-checkconf
- 設定ファイルを作成する
設定サンプルファイルを利用しなかった場合に実施する。
- 管理アクセス用の鍵ファイルを作成する。
rndc-confgen -a
鍵ファイルを別途作成せずに、設定ファイル中に含める場合は次を代わりに実行する。
rndc-confgen > etc/rndc.key
- 基本となる設定ファイルを作成する。
cat >> etc/named.conf << EOT logging { channel "channel_default" { file "log/named.log"; severity warning; print-category yes; print-severity yes; print-time yes; }; category default { "channel_default"; }; }; options { directory "/"; version "version"; }; include "etc/rndc.key"; controls { inet 127.0.0.1 port 953 allow { localhost; } keys { "rndc-key"; }; }; EOT
- ディレクトリ作成
- ログ
ログをsyslogではなくファイルに直接出力する設定を行ったので、出力先のディレクトリを作成する。
mkdir log
- ゾーン
ゾーンファイルは専用にディレクトリを作成した方が管理しやすい。
また、スレーブサーバとしてゾーンファイルを受け取った場合は、別に管理した方が扱いやすい。
mkdir zone-master zone-slave
- ログ
- 設定ファイルに誤りがないか確認する
問題があれば、”Error”が出力される
named-checkconf
- 管理アクセス用の鍵ファイルを作成する。
- ファイル所有者を変更する
chown -R bind:bind /usr/local/bind*
- BINDを起動する
systemctl start bind
- 稼働確認
rndc status
正常に起動していない場合、ログを確認する。
journalctl -u bind cat $BIND_HOME/log/named.log
- 出力例
[root@dns etc]# rndc status version: BIND 9.11.3 (Extended Support Version) <id:a375815> (version) running on dns.corp: Linux x86_64 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 boot time: Wed, 23 May 2018 14:46:52 GMT last configured: Wed, 23 May 2018 14:46:52 GMT configuration file: /etc/named.conf (/usr/local/bind//etc/named.conf) CPUs found: 1 worker threads: 1 UDP listeners per interface: 1 number of zones: 99 (98 automatic) debug level: 0 xfers running: 0 xfers deferred: 0 soa queries in progress: 0 query logging is OFF recursive clients: 0/900/1000 tcp clients: 0/150 server is up and running
- 出力例
- 停止
systemctl stop bind
- ゾーンのテスト
ゾーンファイルを作成して動作確認する場合、次のサンプルゾーンを追記する。
- ゾーン設定の追記
cat >> $BIND_HOME/etc/named.conf << EOT zone "example.com" { type master; file "zone-master/example.com"; allow-query {any;}; }; EOT
- ゾーンファイルの作成
cat > $BIND_HOME/zone-master/example.com << EOT @ 86400 IN SOA ns example.com. ( 2018052301 ;serial 5m ;refresh 5m ;retry 5m ;expire 5m ;minimum ttl each record ) ; same as line "ns" 60 IN NS ns ; "www" is 10.0.0.2 www 60 IN A 10.0.0.2 ; "example.com" (=@) is 10.0.0.1 @ 60 IN A 10.0.0.1 ; "ns" is 192.168.0.10 ns 60 IN A 192.168.0.10 EOT chown bind:bind $BIND_HOME/zone-master/example.com
- 解決テスト
dig @localhost +norecurse example.com
解決できないことを確認
;example.com. IN A
- 設定読み込み
rndc reload
- 解決テスト
dig @localhost +norecurse example.com
解決できることを確認
;; ANSWER SECTION: example.com. 60 IN A 10.0.0.1 ;; AUTHORITY SECTION: example.com. 60 IN NS ns.example.com. ;; ADDITIONAL SECTION: ns.example.com. 60 IN A 192.168.0.10
- ゾーン転送テスト
ローカルホストから実施すること。
dig @localhost axfr example.com
- ゾーン設定の追記
BIND設定
設定変更後、以下のコマンドで設定ファイルの妥当性確認を行うことができる。
named-checkconf設定の反映は次のコマンドで行う
rndc reloador
service reload bind
設定サンプル
named.confの設定サンプルはソースコードディレクトリに多数含まれている。
次のコマンドで確認できる。
find ~/bind-*/ -name named.conf
以下のようなサンプルが存在する。
<ソースコード>/bin/tests/named.conf <ソースコード>/bin/tests/system/acl/ns3/named.conf <ソースコード>/bin/tests/system/acl/ns4/named.conf <ソースコード>/bin/tests/system/additional/ns3/named.conf <ソースコード>/bin/tests/system/addzone/ns1/named.conf <ソースコード>/bin/tests/system/autosign/ns1/named.conf <ソースコード>/bin/tests/system/autosign/ns2/named.conf <ソースコード>/bin/tests/system/autosign/ns3/named.conf <ソースコード>/bin/tests/system/autosign/ns4/named.conf <ソースコード>/bin/tests/system/autosign/ns5/named.conf <ソースコード>/bin/tests/system/builtin/ns1/named.conf <ソースコード>/bin/tests/system/builtin/ns2/named.conf <ソースコード>/bin/tests/system/builtin/ns3/named.conf <ソースコード>/bin/tests/system/cacheclean/ns1/named.conf <ソースコード>/bin/tests/system/cacheclean/ns2/named.conf <ソースコード>/bin/tests/system/case/ns1/named.conf <ソースコード>/bin/tests/system/case/ns2/named.conf <ソースコード>/bin/tests/system/catz/ns1/named.conf <ソースコード>/bin/tests/system/catz/ns3/named.conf <ソースコード>/bin/tests/system/chain/ns1/named.conf <ソースコード>/bin/tests/system/chain/ns2/named.conf <ソースコード>/bin/tests/system/chain/ns5/named.conf <ソースコード>/bin/tests/system/chain/ns7/named.conf <ソースコード>/bin/tests/system/checknames/ns1/named.conf <ソースコード>/bin/tests/system/checknames/ns2/named.conf <ソースコード>/bin/tests/system/checknames/ns3/named.conf <ソースコード>/bin/tests/system/checknames/ns4/named.conf <ソースコード>/bin/tests/system/cookie/ns1/named.conf <ソースコード>/bin/tests/system/cookie/ns2/named.conf <ソースコード>/bin/tests/system/cookie/ns3/named.conf <ソースコード>/bin/tests/system/delzone/ns1/named.conf <ソースコード>/bin/tests/system/delzone/ns2/named.conf <ソースコード>/bin/tests/system/dialup/ns1/named.conf <ソースコード>/bin/tests/system/dialup/ns2/named.conf <ソースコード>/bin/tests/system/dialup/ns3/named.conf <ソースコード>/bin/tests/system/digdelv/ns1/named.conf <ソースコード>/bin/tests/system/digdelv/ns2/named.conf <ソースコード>/bin/tests/system/digdelv/ns3/named.conf <ソースコード>/bin/tests/system/dlv/ns1/named.conf <ソースコード>/bin/tests/system/dlv/ns2/named.conf <ソースコード>/bin/tests/system/dlv/ns3/named.conf <ソースコード>/bin/tests/system/dlv/ns4/named.conf <ソースコード>/bin/tests/system/dlv/ns5/named.conf <ソースコード>/bin/tests/system/dlv/ns6/named.conf <ソースコード>/bin/tests/system/dlz/ns1/named.conf <ソースコード>/bin/tests/system/dlzexternal/ns1/named.conf <ソースコード>/bin/tests/system/dns64/ns1/named.conf <ソースコード>/bin/tests/system/dns64/ns2/named.conf <ソースコード>/bin/tests/system/dnssec/ns1/named.conf <ソースコード>/bin/tests/system/dnssec/ns2/named.conf <ソースコード>/bin/tests/system/dnssec/ns3/named.conf <ソースコード>/bin/tests/system/dnssec/ns6/named.conf <ソースコード>/bin/tests/system/dnssec/ns7/named.conf <ソースコード>/bin/tests/system/dnstap/ns1/named.conf <ソースコード>/bin/tests/system/dnstap/ns2/named.conf <ソースコード>/bin/tests/system/dnstap/ns3/named.conf <ソースコード>/bin/tests/system/dnstap/ns4/named.conf <ソースコード>/bin/tests/system/dscp/ns1/named.conf <ソースコード>/bin/tests/system/dscp/ns2/named.conf <ソースコード>/bin/tests/system/dscp/ns3/named.conf <ソースコード>/bin/tests/system/dscp/ns4/named.conf <ソースコード>/bin/tests/system/dscp/ns5/named.conf <ソースコード>/bin/tests/system/dscp/ns6/named.conf <ソースコード>/bin/tests/system/dscp/ns7/named.conf <ソースコード>/bin/tests/system/dsdigest/ns1/named.conf <ソースコード>/bin/tests/system/dsdigest/ns2/named.conf <ソースコード>/bin/tests/system/dsdigest/ns3/named.conf <ソースコード>/bin/tests/system/dsdigest/ns4/named.conf <ソースコード>/bin/tests/system/dyndb/ns1/named.conf <ソースコード>/bin/tests/system/ecdsa/ns1/named.conf <ソースコード>/bin/tests/system/ecdsa/ns2/named.conf <ソースコード>/bin/tests/system/eddsa/ns1/named.conf <ソースコード>/bin/tests/system/eddsa/ns2/named.conf <ソースコード>/bin/tests/system/ednscompliance/ns1/named.conf <ソースコード>/bin/tests/system/fetchlimit/ns1/named.conf <ソースコード>/bin/tests/system/fetchlimit/ns2/named.conf <ソースコード>/bin/tests/system/formerr/ns1/named.conf <ソースコード>/bin/tests/system/forward/ns1/named.conf <ソースコード>/bin/tests/system/forward/ns2/named.conf <ソースコード>/bin/tests/system/forward/ns3/named.conf <ソースコード>/bin/tests/system/forward/ns4/named.conf <ソースコード>/bin/tests/system/forward/ns5/named.conf <ソースコード>/bin/tests/system/glue/ns1/named.conf <ソースコード>/bin/tests/system/gost/ns1/named.conf <ソースコード>/bin/tests/system/gost/ns2/named.conf <ソースコード>/bin/tests/system/inline/ns1/named.conf <ソースコード>/bin/tests/system/inline/ns2/named.conf <ソースコード>/bin/tests/system/inline/ns3/named.conf <ソースコード>/bin/tests/system/inline/ns4/named.conf <ソースコード>/bin/tests/system/inline/ns6/named.conf <ソースコード>/bin/tests/system/inline/ns7/named.conf <ソースコード>/bin/tests/system/integrity/ns1/named.conf <ソースコード>/bin/tests/system/ixfr/ns3/named.conf <ソースコード>/bin/tests/system/ixfr/ns4/named.conf <ソースコード>/bin/tests/system/legacy/ns2/named.conf <ソースコード>/bin/tests/system/legacy/ns3/named.conf <ソースコード>/bin/tests/system/legacy/ns4/named.conf <ソースコード>/bin/tests/system/legacy/ns5/named.conf <ソースコード>/bin/tests/system/legacy/ns6/named.conf <ソースコード>/bin/tests/system/legacy/ns7/named.conf <ソースコード>/bin/tests/system/limits/ns1/named.conf <ソースコード>/bin/tests/system/lwresd/ns1/named.conf <ソースコード>/bin/tests/system/masterfile/ns1/named.conf <ソースコード>/bin/tests/system/masterfile/ns2/named.conf <ソースコード>/bin/tests/system/masterformat/ns1/named.conf <ソースコード>/bin/tests/system/masterformat/ns2/named.conf <ソースコード>/bin/tests/system/masterformat/ns3/named.conf <ソースコード>/bin/tests/system/mkeys/ns2/named.conf <ソースコード>/bin/tests/system/mkeys/ns3/named.conf <ソースコード>/bin/tests/system/mkeys/ns5/named.conf <ソースコード>/bin/tests/system/names/ns1/named.conf <ソースコード>/bin/tests/system/notify/ns1/named.conf <ソースコード>/bin/tests/system/notify/ns2/named.conf <ソースコード>/bin/tests/system/notify/ns3/named.conf <ソースコード>/bin/tests/system/notify/ns4/named.conf <ソースコード>/bin/tests/system/notify/ns5/named.conf <ソースコード>/bin/tests/system/nslookup/ns1/named.conf <ソースコード>/bin/tests/system/nsupdate/ns1/named.conf <ソースコード>/bin/tests/system/nsupdate/ns2/named.conf <ソースコード>/bin/tests/system/nsupdate/ns3/named.conf <ソースコード>/bin/tests/system/nsupdate/ns5/named.conf <ソースコード>/bin/tests/system/nzd2nzf/ns1/named.conf <ソースコード>/bin/tests/system/pending/ns1/named.conf <ソースコード>/bin/tests/system/pending/ns2/named.conf <ソースコード>/bin/tests/system/pending/ns3/named.conf <ソースコード>/bin/tests/system/pending/ns4/named.conf <ソースコード>/bin/tests/system/pipelined/ns1/named.conf <ソースコード>/bin/tests/system/pipelined/ns2/named.conf <ソースコード>/bin/tests/system/pipelined/ns3/named.conf <ソースコード>/bin/tests/system/pipelined/ns4/named.conf <ソースコード>/bin/tests/system/pkcs11/ns1/named.conf <ソースコード>/bin/tests/system/pkcs11ssl/ns1/named.conf <ソースコード>/bin/tests/system/reclimit/ns1/named.conf <ソースコード>/bin/tests/system/redirect/ns1/named.conf <ソースコード>/bin/tests/system/redirect/ns2/named.conf <ソースコード>/bin/tests/system/redirect/ns3/named.conf <ソースコード>/bin/tests/system/redirect/ns4/named.conf <ソースコード>/bin/tests/system/resolver/ns1/named.conf <ソースコード>/bin/tests/system/resolver/ns4/named.conf <ソースコード>/bin/tests/system/resolver/ns5/named.conf <ソースコード>/bin/tests/system/resolver/ns6/named.conf <ソースコード>/bin/tests/system/rndc/ns2/named.conf <ソースコード>/bin/tests/system/rndc/ns3/named.conf <ソースコード>/bin/tests/system/rndc/ns5/named.conf <ソースコード>/bin/tests/system/rpz/ns1/named.conf <ソースコード>/bin/tests/system/rpz/ns2/named.conf <ソースコード>/bin/tests/system/rpz/ns3/named.conf <ソースコード>/bin/tests/system/rpz/ns4/named.conf <ソースコード>/bin/tests/system/rpz/ns5/named.conf <ソースコード>/bin/tests/system/rpz/ns6/named.conf <ソースコード>/bin/tests/system/rpz/ns7/named.conf <ソースコード>/bin/tests/system/rpzrecurse/ns1/named.conf <ソースコード>/bin/tests/system/rpzrecurse/ns4/named.conf <ソースコード>/bin/tests/system/rrl/ns1/named.conf <ソースコード>/bin/tests/system/rrl/ns2/named.conf <ソースコード>/bin/tests/system/rrl/ns3/named.conf <ソースコード>/bin/tests/system/rrl/ns4/named.conf <ソースコード>/bin/tests/system/rrsetorder/ns1/named.conf <ソースコード>/bin/tests/system/rrsetorder/ns2/named.conf <ソースコード>/bin/tests/system/rrsetorder/ns3/named.conf <ソースコード>/bin/tests/system/rrsetorder/ns4/named.conf <ソースコード>/bin/tests/system/rsabigexponent/ns1/named.conf <ソースコード>/bin/tests/system/rsabigexponent/ns2/named.conf <ソースコード>/bin/tests/system/rsabigexponent/ns3/named.conf <ソースコード>/bin/tests/system/sfcache/ns1/named.conf <ソースコード>/bin/tests/system/sfcache/ns2/named.conf <ソースコード>/bin/tests/system/sfcache/ns5/named.conf <ソースコード>/bin/tests/system/sortlist/ns1/named.conf <ソースコード>/bin/tests/system/spf/ns1/named.conf <ソースコード>/bin/tests/system/staticstub/ns1/named.conf <ソースコード>/bin/tests/system/staticstub/ns4/named.conf <ソースコード>/bin/tests/system/statistics/ns1/named.conf <ソースコード>/bin/tests/system/statistics/ns2/named.conf <ソースコード>/bin/tests/system/statistics/ns3/named.conf <ソースコード>/bin/tests/system/statschannel/ns2/named.conf <ソースコード>/bin/tests/system/stress/ns1/named.conf <ソースコード>/bin/tests/system/stress/ns2/named.conf <ソースコード>/bin/tests/system/stress/ns3/named.conf <ソースコード>/bin/tests/system/stress/ns4/named.conf <ソースコード>/bin/tests/system/stub/ns1/named.conf <ソースコード>/bin/tests/system/stub/ns2/named.conf <ソースコード>/bin/tests/system/stub/ns3/named.conf <ソースコード>/bin/tests/system/tcp/ns1/named.conf <ソースコード>/bin/tests/system/tcp/ns2/named.conf <ソースコード>/bin/tests/system/tcp/ns3/named.conf <ソースコード>/bin/tests/system/tcp/ns4/named.conf <ソースコード>/bin/tests/system/tsig/ns1/named.conf <ソースコード>/bin/tests/system/tsiggss/ns1/named.conf <ソースコード>/bin/tests/system/unknown/ns1/named.conf <ソースコード>/bin/tests/system/unknown/ns2/named.conf <ソースコード>/bin/tests/system/unknown/ns3/named.conf <ソースコード>/bin/tests/system/upforwd/ns1/named.conf <ソースコード>/bin/tests/system/upforwd/ns2/named.conf <ソースコード>/bin/tests/system/upforwd/ns3/named.conf <ソースコード>/bin/tests/system/v6synth/ns1/named.conf <ソースコード>/bin/tests/system/v6synth/ns2/named.conf <ソースコード>/bin/tests/system/v6synth/ns3/named.conf <ソースコード>/bin/tests/system/views/ns1/named.conf <ソースコード>/bin/tests/system/views/ns5/named.conf <ソースコード>/bin/tests/system/wildcard/ns1/named.conf <ソースコード>/bin/tests/system/wildcard/ns2/named.conf <ソースコード>/bin/tests/system/wildcard/ns3/named.conf <ソースコード>/bin/tests/system/wildcard/ns4/named.conf <ソースコード>/bin/tests/system/wildcard/ns5/named.conf <ソースコード>/bin/tests/system/xfer/ns1/named.conf <ソースコード>/bin/tests/system/xfer/ns2/named.conf <ソースコード>/bin/tests/system/xfer/ns3/named.conf <ソースコード>/bin/tests/system/xfer/ns6/named.conf <ソースコード>/bin/tests/system/xfer/ns7/named.conf <ソースコード>/bin/tests/system/xfer/ns8/named.conf <ソースコード>/bin/tests/system/xferquota/ns1/named.conf <ソースコード>/bin/tests/system/xferquota/ns2/named.conf <ソースコード>/bin/tests/system/zero/ns1/named.conf <ソースコード>/bin/tests/system/zero/ns2/named.conf <ソースコード>/bin/tests/system/zero/ns3/named.conf <ソースコード>/bin/tests/system/zero/ns4/named.conf <ソースコード>/bin/tests/system/zonechecks/ns1/named.conf <ソースコード>/bin/tests/system/zonechecks/ns2/named.conf <ソースコード>/bin/tests/virtual-time/autosign-ksk/ns1/named.conf <ソースコード>/bin/tests/virtual-time/autosign-zsk/ns1/named.conf <ソースコード>/bin/tests/virtual-time/slave/ns1/named.conf <ソースコード>/contrib/dlz/example/named.conf <ソースコード>/contrib/dlz/modules/bdbhpt/testing/named.conf <ソースコード>/contrib/dlz/modules/ldap/testing/named.conf <ソースコード>/contrib/dlz/modules/mysql/testing/named.conf <ソースコード>/contrib/dlz/modules/mysqldyn/testing/named.conf <ソースコード>/contrib/dlz/modules/perl/testing/named.conf <ソースコード>/contrib/dlz/modules/sqlite3/testing/named.conf <ソースコード>/contrib/dlz/modules/wildcard/testing/named.conf <ソースコード>/contrib/dnspriv/named.conf
/bin/tests/named.conf
/* * Copyright (C) 1999-2001, 2004, 2007, 2011, 2015, 2016 Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* $Id: named.conf,v 1.60 2011/03/03 23:47:31 tbox Exp $ */ /* * This is a worthless, nonrunnable example of a named.conf file that has * every conceivable syntax element in use. We use it to test the parser. * It could also be used as a conceptual template for users of new features. */ /* * C-style comments are OK */ // So are C++-style comments # So are shell-style comments // watch out for ";" -- it's important! options { additional-from-auth true; additional-from-cache false; version "my version string"; random-device "/dev/random"; directory "/tmp"; port 666; sig-validity-interval 33; # Obsolete named-xfer "/usr/libexec/named-xfer"; // _PATH_XFER dump-file "named_dump.db"; // _PATH_DUMPFILE pid-file "/var/run/named.pid"; // _PATH_PIDFILE statistics-file "named.stats"; // _PATH_STATS memstatistics-file "named.memstats"; // _PATH_MEMSTATS max-cache-ttl 999; auth-nxdomain yes; // always set AA on NXDOMAIN. // don't set this to 'no' unless // you know what you're doing -- older // servers won't like it. # Obsolete deallocate-on-exit no; dialup yes; # Obsolete fake-iquery no; fetch-glue yes; has-old-clients yes; host-statistics no; # Obsolete multiple-cnames no; // if yes, then a name my have more // than one CNAME RR. This use // is non-standard and is not // recommended, but it is available // because previous releases supported // it and it was used by large sites // for load balancing. notify yes; // send NOTIFY messages. You can set // notify on a zone-by-zone // basis in the "zone" statement // see (below) recursion yes; rfc2308-type1 no; # Obsolete use-id-pool yes; # Obsolete treat-cr-as-space yes; also-notify { 10.0.2.3; }; // The "forward" option is only meaningful if you've defined // forwarders. "first" gives the normal BIND // forwarding behavior, i.e. ask the forwarders first, and if that // doesn't work then do the full lookup. You can also say // "forward only;" which is what used to be specified with // "slave" or "options forward-only". "only" will never attempt // a full lookup; only the forwarders will be used. forward first; forwarders { 1.2.3.4; 5.6.7.8; }; check-names master fail; check-names slave warn; check-names response ignore; allow-query { any; }; allow-transfer { any; }; allow-recursion { !any; }; blackhole { 45/24; }; keep-response-order { 46/24; }; listen-on { 10/24; 10.0.0.3; }; listen-on port 53 { any; }; listen-on { 5.6.7.8; }; listen-on port 1234 { !1.2.3.4; 1.2.3/24; }; listen-on-v6 { 1:1:1:1:1:1:1:1; }; listen-on-v6 port 777 { 2:2:2:2:2:2:2:2; }; query-source-v6 address 8:7:6:5:4:3:2:1 port *; query-source port * address 10.0.0.54 ; lame-ttl 444; max-transfer-time-in 300; max-transfer-time-out 10; max-transfer-idle-in 100; max-transfer-idle-out 11; max-retry-time 1234; min-retry-time 1111; max-refresh-time 888; min-refresh-time 777; max-ncache-ttl 333; min-roots 15; serial-queries 34; transfer-format one-answer; transfers-in 10; transfers-per-ns 2; transfers-out 0; transfer-source 10.0.0.5; transfer-source-v6 4:3:2:1:5:6:7:8; request-ixfr yes; provide-ixfr yes; # Now called 'provide-ixfr' # maintain-ixfr-base no; // If yes, keep transaction log file for IXFR max-ixfr-log-size 20m; coresize 100; datasize 101; files 230; max-cache-size 1m; stacksize 231; cleaning-interval 1000; heartbeat-interval 1001; interface-interval 1002; statistics-interval 1003; topology { 10/8; !1.2.3/24; { 1.2/16; 3/8; }; }; sortlist { 10/8; 11/8; }; tkey-domain "foo.com"; tkey-dhkey "xyz" 666 ; rrset-order { class IN type A name "foo" order random; order cyclic; }; }; /* * Control listeners, for "ndc". Every nameserver needs at least one. */ controls { // 'inet' lines without a 'port' defaults to 'port 953' // 'keys' must be used and the list must have at least one entry inet * port 52 allow { any; } keys { "key2"; }; unix "/var/run/ndc" perm 0600 owner 0 group 0; // ignored by named. inet 10.0.0.1 allow { any; key foo; } keys { "key4";}; inet 10.0.0.2 allow { none; } keys { "key-1"; "key-2"; }; inet 10.0.0.2 allow { none; }; }; zone "master.demo.zone" { type master; // what used to be called "primary" database "somedb -option1 -option2 arg1 arg2 arg3"; file "master.demo.zone"; check-names fail; allow-update { none; }; allow-update-forwarding { 10.0.0.5; !any; }; allow-transfer { any; }; allow-query { any; }; sig-validity-interval 990; notify explicit; also-notify { 1.0.0.1; }; // don't notify any nameservers other // than those on the NS list for this // zone forward first; forwarders { 10.0.0.3; 1:2:3:4:5:6:7:8; }; }; zone "slave.demo.zone" { type slave; // what used to be called "secondary" file "slave.demo.zone"; ixfr-base "slave.demo.zone.ixfr"; // File name for IXFR transaction log file masters { 1.2.3.4 port 10 key "foo"; // where to zone transfer from 5.6.7.8; 6.7.8.9 key "zippo"; }; transfer-source 10.0.0.53; // fixes multihoming problems check-names warn; allow-update { none; }; allow-transfer { any; }; allow-update-forwarding { any; }; allow-query { any; }; max-transfer-time-in 120; // if not set, global option is used. max-transfer-time-out 1; // if not set, global option is used. max-transfer-idle-in 2; // if not set, global option is used. max-transfer-idle-out 3; // if not set, global option is used. also-notify { 1.0.0.2; }; forward only; forwarders { 10.45.45.45; 10.0.0.3; 1:2:3:4:5:6:7:8; }; }; key "non-viewkey" { secret "YWFh" ; algorithm "zzz" ; }; view "test-view" in { key "viewkey" { algorithm "xxx" ; secret "eXl5" ; }; also-notify { 10.2.2.3; }; trusted-keys { foo.com. 4 3 2 "abdefghijklmnopqrstuvwxyz"; }; sig-validity-interval 45; max-cache-size 100000; allow-query { 10.0.0.30;}; additional-from-cache false; additional-from-auth no; match-clients { 10.0.0.1 ; }; check-names master warn; check-names slave ignore; check-names response fail; auth-nxdomain false; recursion true; provide-ixfr false; request-ixfr true; fetch-glue true; notify false; rfc2308-type1 false; transfer-source 10.0.0.55; transfer-source-v6 4:3:8:1:5:6:7:8; query-source port * address 10.0.0.54 ; query-source-v6 address 6:6:6:6:6:6:6:6 port *; max-transfer-time-out 45; max-transfer-idle-out 55; cleaning-interval 100; min-roots 3; lame-ttl 477; max-ncache-ttl 333; max-cache-ttl 777; transfer-format many-answers; max-retry-time 7; min-retry-time 4; max-refresh-time 999; min-refresh-time 111; zone "view-zone.com" { type master; allow-update-forwarding { 10.0.0.34;}; file "view-zone-master"; }; server 5.6.7.8 { keys "viewkey"; }; server 10.9.8.7 { keys "non-viewkey"; }; dialup yes; }; zone "stub.demo.zone" { type stub; // stub zones are like slave zones, // except that only the NS records // are transferred. dialup yes; file "stub.demo.zone"; masters { 1.2.3.4 ; // where to zone transfer from 5.6.7.8 port 999; }; check-names warn; allow-update { none; }; allow-transfer { any; }; allow-query { any; }; max-retry-time 10; min-retry-time 11; max-refresh-time 12; min-refresh-time 13; max-transfer-time-in 120; // if not set, global option is used. pubkey 257 255 1 "a useless key"; pubkey 257 255 1 "another useless key"; }; zone "." { type hint; // used to be specified w/ "cache" file "cache.db"; // pubkey 257 255 1 "AQP2fHpZ4VMpKo/jc9Fod821uyfY5p8j5h/Am0V/KpBTMZjdXmp9QJe6yFRoIIzkaNCgTIftASdpXGgCwFB2j2KXP/rick6gvEer5VcDEkLR5 ==";Q};
trusted-keys { "." 257 255 1 "AQP2fHpZ4VMpKo/jc9Fod821uyfY5p8j5h/Am0V/KpBTMZjdXmp9QJe6yFRoIIzkaNCgTIftASdpXGgCwFB2j2KXP/rick6gvEer5VcDEkLR5Q== ;“};
acl can_query { !1.2.3/24; any; }; // network 1.2.3.0 mask 255.255.255.0 // is disallowed; rest are OK acl can_axfr { 1.2.3.4; can_query; }; // host 1.2.3.4 and any host allowed // by can_query are OK zone "disabled-zone.com" { type master; file "bar"; max-retry-time 100; min-retry-time 110; max-refresh-time 120; min-refresh-time 130; }; zone "non-default-acl.demo.zone" { type master; file "foo"; allow-query { can_query; }; allow-transfer { can_axfr; }; allow-update { 1.2.3.4; 5.6.7.8; }; pubkey 666 665 664 "key of the beast"; // Errors trapped by parser: // identity or name not absolute // 'wildcard' match type and no wildcard character in name // // issues: // - certain rdatatype values (such as "key") are config file keywords and // must be quoted or a syntax error will occur. // update-policy { grant root.domain. subdomain host.domain. A MX CNAME; grant sub.root.domain. wildcard *.host.domain. A; grant root.domain. name host.domain. a ns md mf cname soa mb mg mr "null" wks ptr hinfo minfo mx txt rp afsdb x25 isdn rt nsap sig "key" px gpos aaaa loc nxt srv naptr kx cert a6 dname opt unspec uri tkey tsig ; grant foo.bar.com. self foo.bar.com. a; }; }; key sample_key { // for TSIG; supported by parser algorithm hmac-md5; // but not yet implemented in the secret "eW91ciBzZWNyZXQgaGVyZQ=="; // rest of the server }; key key2 { algorithm hmac-md5; secret "ZXJlaCB0ZXJjZXMgcm91eQ=="; }; acl key_acl { key sample_key; }; // a request signed with sample_key server 1.2.3.4 { request-ixfr no; provide-ixfr no; bogus no; // if yes, we won't query or listen // to this server transfer-format one-answer; // set transfer format for this // server (see the description of // 'transfer-format' above) // if not specified, the global option // will be used transfers 0; // not implemented keys { "sample_key" }; // for TSIG; supported by the parser // but not yet implemented in the // rest of the server # Now called 'request-ixfr' # support-ixfr yes; // for IXFR supported by server // if yes, the listed server talks IXFR }; logging { /* * All log output goes to one or more "channels"; you can make as * many of them as you want. */ channel syslog_errors { // this channel will send errors or syslog user; // or worse to syslog (user facility) severity error; }; channel stderr_errors { stderr; }; /* * Channels have a severity level. Messages at severity levels * greater than or equal to the channel's level will be logged on * the channel. In order of decreasing severity, the levels are: * * critical a fatal error * error * warning * notice a normal, but significant event * info an informational message * debug 1 the least detailed debugging info * ... * debug 99 the most detailed debugging info */ /* * Here are the built-in channels: * * channel default_syslog { * syslog daemon; * severity info; * }; * * channel default_debug { * file "named.run"; // note: stderr is used instead * // of "named.run" if the server * // is started with the "-f" * // option. * severity dynamic; // this means log debugging * // at whatever debugging level * // the server is at, and don't * // log anything if not * // debugging. * }; * * channel null { // this is the bit bucket; * file "/dev/null"; // any logging to this channel * // is discarded. * }; * * channel default_stderr { // writes to stderr * file "<stderr>"; // this is illustrative only; * // there's currently no way * // of saying "stderr" in the * // configuration language. * // i.e. don't try this at home. * severity info; * }; * * default_stderr only works before the server daemonizes (i.e. * during initial startup) or when it is running in foreground * mode (-f command line option). */ /* * There are many categories, so you can send the logs * you want to see wherever you want, without seeing logs you * don't want. Right now the categories are * * default the catch-all. many things still * aren't classified into categories, and * they all end up here. also, if you * don't specify any channels for a * category, the default category is used * instead. * config high-level configuration file * processing * parser low-level configuration file processing * queries what used to be called "query logging" * lame-servers messages like "Lame server on ..." * statistics * panic if the server has to shut itself * down due to an internal problem, it * logs the problem here (as well as * in the problem's native category) * update dynamic update * ncache negative caching * xfer-in zone transfers we're receiving * xfer-out zone transfers we're sending * db all database operations * eventlib debugging info from the event system * (see below) * packet dumps of packets received and sent * (see below) * notify the NOTIFY protocol * cname messages like "XX points to a CNAME" * security approved/unapproved requests * os operating system problems * insist consistency check failures * maintenance periodic maintenance * load zone loading * response-checks messages like * "Malformed response ..." * "wrong ans. name ..." * "unrelated additional info ..." * "invalid RR type ..." * "bad referral ..." */ category parser { syslog_errors; // you can log to as many channels default_syslog; // as you want }; category lame-servers { null; }; // don't log these at all channel moderate_debug { file "foo"; // foo severity debug 3; // level 3 debugging to file print-time yes; // timestamp log entries print-category yes; // print category name print-severity yes; // print severity level /* * Note that debugging must have been turned on either * on the command line or with a signal to get debugging * output (non-debugging output will still be written to * this channel). */ }; channel another { file "bar" versions 99 size 10M; severity info; }; channel third { file "bar" size 100000 versions unlimited; severity debug; // use default debug level }; /* * If you don't want to see "zone XXXX loaded" messages but do * want to see any problems, you could do the following. */ channel no_info_messages { syslog; severity notice; }; category load { no_info_messages; }; /* * You can also define category "default"; it gets used when no * "category" statement has been given for a category. */ category default { default_syslog; moderate_debug; }; /* * If you don't define category default yourself, the default * default category will be used. It is * * category default { default_syslog; default_debug; }; */ /* * If you don't define category panic yourself, the default * panic category will be used. It is * * category panic { default_syslog; default_stderr; }; */ /* * Two categories, 'packet' and 'eventlib', are special. Only one * channel may be assigned to each of them, and it must be a * file channel. If you don't define them yourself, they default to * * category eventlib { default_debug; }; * * category packet { default_debug; }; */ }; #include "filename"; // can't do within a statement
named.conf
メインの設定ファイル
vi $BIND_HOME/etc/named.conf
記法
コメント
コメントの書式は以下がサポートされている。
/* comment */
// comment
# comment
標準設定一覧
次のコマンドで確認可能
postconf -d
設定項目
ACLステートメント
acl string { address_match_element; ... };
CONTROLSステートメント
BINDの管理のためのアクセスリソースを設定する。
- 書式
controls { [ inet ( ip_addr | * ) [ port ip_port ] allow { address_match_list } [ keys { key_list } ] [ unix path perm number owner number group number [ keys { key_list } ] [ read-only yes_or_no ] ; ] [ ...; ] };
inet
rndc接続用のTCPソケットを待ち受けるアドレス、ポートなどを設定する。
- 書式
inet [<IPアドレス> | *] { port <ポート番号> } allow <接続元IPアドレス> {; ...} { keys <パスワード> {; ...} } { read-only [yes|no] };
- allow 接続元IPアドレス
アスタリスクをワイルドカードとして記述可能
例:
10.*
- keys パスワード
指定しない場合、次のパスのファイルを読み込みパスワードとして設定する。
$BIND_HOME/etc/rndc.key
- デフォルト
inet 127.0.0.1 port 953 allow { 127.0.0.1; }; inet ::1 port 953 allow { ::1; };
unix
- 書式
unix '<パス>' perm integer owner integer group integer [ keys { string; ... } ] [ read-only boolean ];
DLZステートメント
- 書式
dlz string { database string; search boolean; };
DYNDBステートメント
- 書式
dyndb string quoted_string { unspecified-text };
KEYステートメント
- 書式
key string { algorithm string; secret string; };
LOGGINGステートメント
- 書式
logging { category string { string; ... }; channel string { buffered boolean; file quoted_string [ versions ( "unlimited" | integer ) ] [ size size ]; null; print-category boolean; print-severity boolean; print-time boolean; severity log_severity; stderr; syslog [ syslog_facility ]; }; };
LWRESステートメント
- 書式
lwres { listen-on [ port integer ] [ dscp integer ] { ( ipv4_address | ipv6_address ) [ port integer ] [ dscp integer ]; ... }; lwres-clients integer; lwres-tasks integer; ndots integer; search { string; ... }; view string [ class ]; };
MANAGED-KEYSステートメント
- 書式
managed-keys { string string integer integer integer quoted_string; ... };
MASTERSステートメント
- 書式
masters string [ port integer ] [ dscp integer ] { ( masters | ipv4_address [ port integer ] | ipv6_address [ port integer ] ) [ key string ]; ... };
KEYステートメント
- 書式
key string { algorithm string; secret string; };
LOGGINGステートメント
- 書式
logging { category string { string; ... }; channel string { buffered boolean; file quoted_string [ versions ( "unlimited" | integer ) ] [ size size ]; null; print-category boolean; print-severity boolean; print-time boolean; severity log_severity; stderr; syslog [ syslog_facility ]; }; };
category
https://ftp.isc.org/isc/bind9/cur/9.9/doc/arm/Bv9ARM.ch06.html#logging_grammar
LWRESステートメント
- 書式
lwres { listen-on [ port integer ] [ dscp integer ] { ( ipv4_address | ipv6_address ) [ port integer ] [ dscp integer ]; ... }; lwres-clients integer; lwres-tasks integer; ndots integer; search { string; ... }; view string [ class ]; };
MANAGED-KEYSステートメント
- 書式
managed-keys { string string integer integer integer quoted_string; ... };
MASTERSステートメント
- 書式
masters string [ port integer ] [ dscp integer ] { ( masters | ipv4_address [ port integer ] | ipv6_address [ port integer ] ) [ key string ]; ... };
OPTIONSステートメント
- 書式
options { acache-cleaning-interval integer; acache-enable boolean; additional-from-auth boolean; additional-from-cache boolean; allow-new-zones boolean; allow-notify { address_match_element; ... }; allow-query { address_match_element; ... }; allow-query-cache { address_match_element; ... }; allow-query-cache-on { address_match_element; ... }; allow-query-on { address_match_element; ... }; allow-recursion { address_match_element; ... }; allow-recursion-on { address_match_element; ... }; allow-transfer { address_match_element; ... }; allow-update { address_match_element; ... }; allow-update-forwarding { address_match_element; ... }; also-notify [ port integer ] [ dscp integer ] { ( masters | ipv4_address [ port integer ] | ipv6_address [ port integer ] ) [ key string ]; ... }; alt-transfer-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; alt-transfer-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; attach-cache string; auth-nxdomain boolean; // default changed auto-dnssec ( allow | maintain | off ); automatic-interface-scan boolean; avoid-v4-udp-ports { portrange; ... }; avoid-v6-udp-ports { portrange; ... }; bindkeys-file quoted_string; blackhole { address_match_element; ... }; cache-file quoted_string; catalog-zones { zone quoted_string [ default-masters [ port integer ] [ dscp integer ] { ( masters | ipv4_address [ port integer ] | ipv6_address [ port integer ] ) [ key string ]; ... } ] [ zone-directory quoted_string ] [ in-memory boolean ] [ min-update-interval integer ]; ... }; check-dup-records ( fail | warn | ignore ); check-integrity boolean; check-mx ( fail | warn | ignore ); check-mx-cname ( fail | warn | ignore ); check-names ( master | slave | response ) ( fail | warn | ignore ); check-sibling boolean; check-spf ( warn | ignore ); check-srv-cname ( fail | warn | ignore ); check-wildcard boolean; cleaning-interval integer; clients-per-query integer; cookie-algorithm ( aes | sha1 | sha256 ); cookie-secret string; coresize ( default | unlimited | sizeval ); datasize ( default | unlimited | sizeval ); deny-answer-addresses { address_match_element; ... } [ except-from { quoted_string; ... } ]; deny-answer-aliases { quoted_string; ... } [ except-from { quoted_string; ... } ]; dialup ( notify | notify-passive | passive | refresh | boolean ); directory quoted_string; disable-algorithms string { string; ... }; disable-ds-digests string { string; ... }; disable-empty-zone string; dns64 netprefix { break-dnssec boolean; clients { address_match_element; ... }; exclude { address_match_element; ... }; mapped { address_match_element; ... }; recursive-only boolean; suffix ipv6_address; }; dns64-contact string; dns64-server string; dnssec-accept-expired boolean; dnssec-dnskey-kskonly boolean; dnssec-enable boolean; dnssec-loadkeys-interval integer; dnssec-lookaside ( string trust-anchor string | auto | no ); dnssec-must-be-secure string boolean; dnssec-secure-to-insecure boolean; dnssec-update-mode ( maintain | no-resign ); dnssec-validation ( yes | no | auto ); dnstap { ( all | auth | client | forwarder | resolver ) [ ( query | response ) ]; ... }; dnstap-identity ( quoted_string | none | hostname ); dnstap-output ( file | unix ) quoted_string; dnstap-version ( quoted_string | none ); dscp integer; dual-stack-servers [ port integer ] { ( quoted_string [ port integer ] [ dscp integer ] | ipv4_address [ port integer ] [ dscp integer ] | ipv6_address [ port integer ] [ dscp integer ] ); ... }; dump-file quoted_string; edns-udp-size integer; empty-contact string; empty-server string; empty-zones-enable boolean; fetch-quota-params integer fixedpoint fixedpoint fixedpoint; fetches-per-server integer [ ( drop | fail ) ]; fetches-per-zone integer [ ( drop | fail ) ]; files ( default | unlimited | sizeval ); filter-aaaa { address_match_element; ... }; filter-aaaa-on-v4 ( break-dnssec | boolean ); filter-aaaa-on-v6 ( break-dnssec | boolean ); flush-zones-on-shutdown boolean; forward ( first | only ); forwarders [ port integer ] [ dscp integer ] { ( ipv4_address | ipv6_address ) [ port integer ] [ dscp integer ]; ... }; fstrm-set-buffer-hint integer; fstrm-set-flush-timeout integer; fstrm-set-input-queue-size integer; fstrm-set-output-notify-threshold integer; fstrm-set-output-queue-model ( mpsc | spsc ); fstrm-set-output-queue-size integer; fstrm-set-reopen-interval integer; geoip-directory ( quoted_string | none ); geoip-use-ecs boolean; heartbeat-interval integer; hostname ( quoted_string | none ); inline-signing boolean; interface-interval integer; ixfr-from-differences ( master | slave | boolean ); keep-response-order { address_match_element; ... }; key-directory quoted_string; lame-ttl ttlval; listen-on [ port integer ] [ dscp integer ] { address_match_element; ... }; listen-on-v6 [ port integer ] [ dscp integer ] { address_match_element; ... }; lmdb-mapsize sizeval; lock-file ( quoted_string | none ); managed-keys-directory quoted_string; masterfile-format ( map | raw | text ); masterfile-style ( full | relative ); match-mapped-addresses boolean; max-acache-size ( unlimited | sizeval ); max-cache-size ( default | unlimited | sizeval | percentage ); max-cache-ttl integer; max-clients-per-query integer; max-journal-size ( unlimited | sizeval ); max-ncache-ttl integer; max-records integer; max-recursion-depth integer; max-recursion-queries integer; max-refresh-time integer; max-retry-time integer; max-rsa-exponent-size integer; max-transfer-idle-in integer; max-transfer-idle-out integer; max-transfer-time-in integer; max-transfer-time-out integer; max-udp-size integer; max-zone-ttl ( unlimited | ttlval ); memstatistics boolean; memstatistics-file quoted_string; message-compression boolean; min-refresh-time integer; min-retry-time integer; minimal-any boolean; minimal-responses ( no-auth | no-auth-recursive | boolean ); multi-master boolean; no-case-compress { address_match_element; ... }; nocookie-udp-size integer; notify ( explicit | master-only | boolean ); notify-delay integer; notify-rate integer; notify-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; notify-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; notify-to-soa boolean; nta-lifetime ttlval; nta-recheck ttlval; nxdomain-redirect string; pid-file ( quoted_string | none ); port integer; preferred-glue string; prefetch integer [ integer ]; provide-ixfr boolean; query-source ( ( [ address ] ( ipv4_address | * ) [ port ( integer | * ) ] ) | ( [ [ address ] ( ipv4_address | * ) ] port ( integer | * ) ) ) [ dscp integer ]; query-source-v6 ( ( [ address ] ( ipv6_address | * ) [ port ( integer | * ) ] ) | ( [ [ address ] ( ipv6_address | * ) ] port ( integer | * ) ) ) [ dscp integer ]; querylog boolean; random-device quoted_string; rate-limit { all-per-second integer; errors-per-second integer; exempt-clients { address_match_element; ... }; ipv4-prefix-length integer; ipv6-prefix-length integer; log-only boolean; max-table-size integer; min-table-size integer; nodata-per-second integer; nxdomains-per-second integer; qps-scale integer; referrals-per-second integer; responses-per-second integer; slip integer; window integer; }; recursing-file quoted_string; recursion boolean; recursive-clients integer; request-expire boolean; request-ixfr boolean; request-nsid boolean; require-server-cookie boolean; reserved-sockets integer; resolver-query-timeout integer; response-policy { zone quoted_string [ log boolean ] [ max-policy-ttl integer ] [ policy ( cname | disabled | drop | given | no-op | nodata | nxdomain | passthru | tcp-only quoted_string ) ] [ recursive-only boolean ]; ... } [ break-dnssec boolean ] [ max-policy-ttl integer ] [ min-ns-dots integer ] [ nsip-wait-recurse boolean ] [ qname-wait-recurse boolean ] [ recursive-only boolean ]; root-delegation-only [ exclude { quoted_string; ... } ]; rrset-order { [ class string ] [ type string ] [ name quoted_string ] string string; ... }; secroots-file quoted_string; send-cookie boolean; serial-query-rate integer; serial-update-method ( date | increment | unixtime ); server-id ( quoted_string | none | hostname ); servfail-ttl ttlval; session-keyalg string; session-keyfile ( quoted_string | none ); session-keyname string; sig-signing-nodes integer; sig-signing-signatures integer; sig-signing-type integer; sig-validity-interval integer [ integer ]; sortlist { address_match_element; ... }; stacksize ( default | unlimited | sizeval ); startup-notify-rate integer; statistics-file quoted_string; tcp-clients integer; tcp-listen-queue integer; tkey-dhkey quoted_string integer; tkey-domain quoted_string; tkey-gssapi-credential quoted_string; tkey-gssapi-keytab quoted_string; transfer-format ( many-answers | one-answer ); transfer-message-size integer; transfer-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; transfer-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; transfers-in integer; transfers-out integer; transfers-per-ns integer; trust-anchor-telemetry boolean; // experimental try-tcp-refresh boolean; update-check-ksk boolean; use-alt-transfer-source boolean; use-v4-udp-ports { portrange; ... }; use-v6-udp-ports { portrange; ... }; v6-bias integer; version ( quoted_string | none ); zero-no-soa-ttl boolean; zero-no-soa-ttl-cache boolean; zone-statistics ( full | terse | none | boolean ); };
version
バージョン情報を記載する。
ndcコマンドの問い合わせやchaosクラスのversion.bind名の問い合わせの際に使用される。
allow-query
DNS問い合わせを許可するホストのリスト
allow-transfer
ゾーン転送を要求することを許可するホスト。
未設定の場合、allow-query-cache設定が使用される。
allow-query-cacheが未設定の場合、allow-query設定が使用される。
allow-queryが未設定の場合、サーバのローカルネットワークとローカルホストのみが許可される。
recursion
再帰問い合わせを許可するかどうか。
allow-recursion
再帰問い合わせを許可するホストのリスト。
未設定の場合、allow-query-cache設定が使用される。
allow-query-cacheが未設定の場合、allow-query設定が使用される。
allow-queryが未設定の場合、サーバのローカルネットワークとローカルホストのみが許可される。
SERVERステートメント
- 書式
server netprefix { bogus boolean; edns boolean; edns-udp-size integer; edns-version integer; keys server_key; max-udp-size integer; notify-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; notify-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; provide-ixfr boolean; query-source ( ( [ address ] ( ipv4_address | * ) [ port ( integer | * ) ] ) | ( [ [ address ] ( ipv4_address | * ) ] port ( integer | * ) ) ) [ dscp integer ]; query-source-v6 ( ( [ address ] ( ipv6_address | * ) [ port ( integer | * ) ] ) | ( [ [ address ] ( ipv6_address | * ) ] port ( integer | * ) ) ) [ dscp integer ]; request-expire boolean; request-ixfr boolean; request-nsid boolean; send-cookie boolean; tcp-only boolean; transfer-format ( many-answers | one-answer ); transfer-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; transfer-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; transfers integer; };
STATISTICS-CHANNELSステートメント
- 書式
statistics-channels { inet ( ipv4_address | ipv6_address | * ) [ port ( integer | * ) ] [ allow { address_match_element; ... } ]; };
TRUSTED-KEYSステートメント
- 書式
trusted-keys { string integer integer integer quoted_string; ... };
VIEWステートメント
- 書式
view string [ class ] { acache-cleaning-interval integer; acache-enable boolean; additional-from-auth boolean; additional-from-cache boolean; allow-new-zones boolean; allow-notify { address_match_element; ... }; allow-query { address_match_element; ... }; allow-query-cache { address_match_element; ... }; allow-query-cache-on { address_match_element; ... }; allow-query-on { address_match_element; ... }; allow-recursion { address_match_element; ... }; allow-recursion-on { address_match_element; ... }; allow-transfer { address_match_element; ... }; allow-update { address_match_element; ... }; allow-update-forwarding { address_match_element; ... }; also-notify [ port integer ] [ dscp integer ] { ( masters | ipv4_address [ port integer ] | ipv6_address [ port integer ] ) [ key string ]; ... }; alt-transfer-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; alt-transfer-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; attach-cache string; auth-nxdomain boolean; // default changed auto-dnssec ( allow | maintain | off ); cache-file quoted_string; catalog-zones { zone quoted_string [ default-masters [ port integer ] [ dscp integer ] { ( masters | ipv4_address [ port integer ] | ipv6_address [ port integer ] ) [ key string ]; ... } ] [ zone-directory quoted_string ] [ in-memory boolean ] [ min-update-interval integer ]; ... }; check-dup-records ( fail | warn | ignore ); check-integrity boolean; check-mx ( fail | warn | ignore ); check-mx-cname ( fail | warn | ignore ); check-names ( master | slave | response ) ( fail | warn | ignore ); check-sibling boolean; check-spf ( warn | ignore ); check-srv-cname ( fail | warn | ignore ); check-wildcard boolean; cleaning-interval integer; clients-per-query integer; deny-answer-addresses { address_match_element; ... } [ except-from { quoted_string; ... } ]; deny-answer-aliases { quoted_string; ... } [ except-from { quoted_string; ... } ]; dialup ( notify | notify-passive | passive | refresh | boolean ); disable-algorithms string { string; ... }; disable-ds-digests string { string; ... }; disable-empty-zone string; dlz string { database string; search boolean; }; dns64 netprefix { break-dnssec boolean; clients { address_match_element; ... }; exclude { address_match_element; ... }; mapped { address_match_element; ... }; recursive-only boolean; suffix ipv6_address; }; dns64-contact string; dns64-server string; dnssec-accept-expired boolean; dnssec-dnskey-kskonly boolean; dnssec-enable boolean; dnssec-loadkeys-interval integer; dnssec-lookaside ( string trust-anchor string | auto | no ); dnssec-must-be-secure string boolean; dnssec-secure-to-insecure boolean; dnssec-update-mode ( maintain | no-resign ); dnssec-validation ( yes | no | auto ); dnstap { ( all | auth | client | forwarder | resolver ) [ ( query | response ) ]; ... }; dual-stack-servers [ port integer ] { ( quoted_string [ port integer ] [ dscp integer ] | ipv4_address [ port integer ] [ dscp integer ] | ipv6_address [ port integer ] [ dscp integer ] ); ... }; dyndb string quoted_string { unspecified-text }; edns-udp-size integer; empty-contact string; empty-server string; empty-zones-enable boolean; fetch-quota-params integer fixedpoint fixedpoint fixedpoint; fetches-per-server integer [ ( drop | fail ) ]; fetches-per-zone integer [ ( drop | fail ) ]; filter-aaaa { address_match_element; ... }; filter-aaaa-on-v4 ( break-dnssec | boolean ); filter-aaaa-on-v6 ( break-dnssec | boolean ); forward ( first | only ); forwarders [ port integer ] [ dscp integer ] { ( ipv4_address | ipv6_address ) [ port integer ] [ dscp integer ]; ... }; inline-signing boolean; ixfr-from-differences ( master | slave | boolean ); key string { algorithm string; secret string; }; key-directory quoted_string; lame-ttl ttlval; lmdb-mapsize sizeval; managed-keys { string string integer integer integer quoted_string; ... }; masterfile-format ( map | raw | text ); masterfile-style ( full | relative ); match-clients { address_match_element; ... }; match-destinations { address_match_element; ... }; match-recursive-only boolean; max-acache-size ( unlimited | sizeval ); max-cache-size ( default | unlimited | sizeval | percentage ); max-cache-ttl integer; max-clients-per-query integer; max-journal-size ( unlimited | sizeval ); max-ncache-ttl integer; max-records integer; max-recursion-depth integer; max-recursion-queries integer; max-refresh-time integer; max-retry-time integer; max-transfer-idle-in integer; max-transfer-idle-out integer; max-transfer-time-in integer; max-transfer-time-out integer; max-udp-size integer; max-zone-ttl ( unlimited | ttlval ); message-compression boolean; min-refresh-time integer; min-retry-time integer; minimal-any boolean; minimal-responses ( no-auth | no-auth-recursive | boolean ); multi-master boolean; no-case-compress { address_match_element; ... }; nocookie-udp-size integer; notify ( explicit | master-only | boolean ); notify-delay integer; notify-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; notify-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; notify-to-soa boolean; nta-lifetime ttlval; nta-recheck ttlval; nxdomain-redirect string; preferred-glue string; prefetch integer [ integer ]; provide-ixfr boolean; query-source ( ( [ address ] ( ipv4_address | * ) [ port ( integer | * ) ] ) | ( [ [ address ] ( ipv4_address | * ) ] port ( integer | * ) ) ) [ dscp integer ]; query-source-v6 ( ( [ address ] ( ipv6_address | * ) [ port ( integer | * ) ] ) | ( [ [ address ] ( ipv6_address | * ) ] port ( integer | * ) ) ) [ dscp integer ]; rate-limit { all-per-second integer; errors-per-second integer; exempt-clients { address_match_element; ... }; ipv4-prefix-length integer; ipv6-prefix-length integer; log-only boolean; max-table-size integer; min-table-size integer; nodata-per-second integer; nxdomains-per-second integer; qps-scale integer; referrals-per-second integer; responses-per-second integer; slip integer; window integer; }; recursion boolean; request-expire boolean; request-ixfr boolean; request-nsid boolean; require-server-cookie boolean; resolver-query-timeout integer; response-policy { zone quoted_string [ log boolean ] [ max-policy-ttl integer ] [ policy ( cname | disabled | drop | given | no-op | nodata | nxdomain | passthru | tcp-only quoted_string ) ] [ recursive-only boolean ]; ... } [ break-dnssec boolean ] [ max-policy-ttl integer ] [ min-ns-dots integer ] [ nsip-wait-recurse boolean ] [ qname-wait-recurse boolean ] [ recursive-only boolean ]; root-delegation-only [ exclude { quoted_string; ... } ]; rrset-order { [ class string ] [ type string ] [ name quoted_string ] string string; ... }; send-cookie boolean; serial-update-method ( date | increment | unixtime ); server netprefix { bogus boolean; edns boolean; edns-udp-size integer; edns-version integer; keys server_key; max-udp-size integer; notify-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; notify-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; provide-ixfr boolean; query-source ( ( [ address ] ( ipv4_address | * ) [ port ( integer | * ) ] ) | ( [ [ address ] ( ipv4_address | * ) ] port ( integer | * ) ) ) [ dscp integer ]; query-source-v6 ( ( [ address ] ( ipv6_address | * ) [ port ( integer | * ) ] ) | ( [ [ address ] ( ipv6_address | * ) ] port ( integer | * ) ) ) [ dscp integer ]; request-expire boolean; request-ixfr boolean; request-nsid boolean; send-cookie boolean; tcp-only boolean; transfer-format ( many-answers | one-answer ); transfer-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; transfer-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; transfers integer; }; servfail-ttl ttlval; sig-signing-nodes integer; sig-signing-signatures integer; sig-signing-type integer; sig-validity-interval integer [ integer ]; sortlist { address_match_element; ... }; transfer-format ( many-answers | one-answer ); transfer-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; transfer-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; trust-anchor-telemetry boolean; // experimental trusted-keys { string integer integer integer quoted_string; ... }; try-tcp-refresh boolean; update-check-ksk boolean; use-alt-transfer-source boolean; v6-bias integer; zero-no-soa-ttl boolean; zero-no-soa-ttl-cache boolean; zone string [ class ] { allow-notify { address_match_element; ... }; allow-query { address_match_element; ... }; allow-query-on { address_match_element; ... }; allow-transfer { address_match_element; ... }; allow-update { address_match_element; ... }; allow-update-forwarding { address_match_element; ... }; also-notify [ port integer ] [ dscp integer ] { ( masters | ipv4_address [ port integer ] | ipv6_address [ port integer ] ) [ key string ]; ... }; alt-transfer-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; alt-transfer-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; auto-dnssec ( allow | maintain | off ); check-dup-records ( fail | warn | ignore ); check-integrity boolean; check-mx ( fail | warn | ignore ); check-mx-cname ( fail | warn | ignore ); check-names ( fail | warn | ignore ); check-sibling boolean; check-spf ( warn | ignore ); check-srv-cname ( fail | warn | ignore ); check-wildcard boolean; database string; delegation-only boolean; dialup ( notify | notify-passive | passive | refresh | boolean ); dlz string; dnssec-dnskey-kskonly boolean; dnssec-loadkeys-interval integer; dnssec-secure-to-insecure boolean; dnssec-update-mode ( maintain | no-resign ); file quoted_string; forward ( first | only ); forwarders [ port integer ] [ dscp integer ] { ( ipv4_address | ipv6_address ) [ port integer ] [ dscp integer ]; ... }; in-view string; inline-signing boolean; ixfr-from-differences boolean; journal quoted_string; key-directory quoted_string; masterfile-format ( map | raw | text ); masterfile-style ( full | relative ); masters [ port integer ] [ dscp integer ] { ( masters | ipv4_address [ port integer ] | ipv6_address [ port integer ] ) [ key string ]; ... }; max-ixfr-log-size ( default | unlimited | max-journal-size ( unlimited | sizeval ); max-records integer; max-refresh-time integer; max-retry-time integer; max-transfer-idle-in integer; max-transfer-idle-out integer; max-transfer-time-in integer; max-transfer-time-out integer; max-zone-ttl ( unlimited | ttlval ); min-refresh-time integer; min-retry-time integer; multi-master boolean; notify ( explicit | master-only | boolean ); notify-delay integer; notify-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; notify-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; notify-to-soa boolean; pubkey integer integer integer request-expire boolean; request-ixfr boolean; serial-update-method ( date | increment | unixtime ); server-addresses { ( ipv4_address | ipv6_address ) [ port integer ]; ... }; server-names { quoted_string; ... }; sig-signing-nodes integer; sig-signing-signatures integer; sig-signing-type integer; sig-validity-interval integer [ integer ]; transfer-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; transfer-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; try-tcp-refresh boolean; type ( delegation-only | forward | hint | master | redirect | slave | static-stub | stub ); update-check-ksk boolean; update-policy ( local | { ( deny | grant ) string ( 6to4-self | external | krb5-self | krb5-subdomain | ms-self | ms-subdomain | name | self | selfsub | selfwild | subdomain | tcp-self | wildcard | zonesub ) [ string ] rrtypelist; ... }; use-alt-transfer-source boolean; zero-no-soa-ttl boolean; zone-statistics ( full | terse | none | boolean ); }; zone-statistics ( full | terse | none | boolean ); };
ZONEステートメント
- 書式
zone string [ class ] { allow-notify { address_match_element; ... }; allow-query { address_match_element; ... }; allow-query-on { address_match_element; ... }; allow-transfer { address_match_element; ... }; allow-update { address_match_element; ... }; allow-update-forwarding { address_match_element; ... }; also-notify [ port integer ] [ dscp integer ] { ( masters | ipv4_address [ port integer ] | ipv6_address [ port integer ] ) [ key string ]; ... }; alt-transfer-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; alt-transfer-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; auto-dnssec ( allow | maintain | off ); check-dup-records ( fail | warn | ignore ); check-integrity boolean; check-mx ( fail | warn | ignore ); check-mx-cname ( fail | warn | ignore ); check-names ( fail | warn | ignore ); check-sibling boolean; check-spf ( warn | ignore ); check-srv-cname ( fail | warn | ignore ); check-wildcard boolean; database string; delegation-only boolean; dialup ( notify | notify-passive | passive | refresh | boolean ); dlz string; dnssec-dnskey-kskonly boolean; dnssec-loadkeys-interval integer; dnssec-secure-to-insecure boolean; dnssec-update-mode ( maintain | no-resign ); file quoted_string; forward ( first | only ); forwarders [ port integer ] [ dscp integer ] { ( ipv4_address | ipv6_address ) [ port integer ] [ dscp integer ]; ... }; in-view string; inline-signing boolean; ixfr-from-differences boolean; journal quoted_string; key-directory quoted_string; masterfile-format ( map | raw | text ); masterfile-style ( full | relative ); masters [ port integer ] [ dscp integer ] { ( masters | ipv4_address [ port integer ] | ipv6_address [ port integer ] ) [ key string ]; ... }; max-journal-size ( unlimited | sizeval ); max-records integer; max-refresh-time integer; max-retry-time integer; max-transfer-idle-in integer; max-transfer-idle-out integer; max-transfer-time-in integer; max-transfer-time-out integer; max-zone-ttl ( unlimited | ttlval ); min-refresh-time integer; min-retry-time integer; multi-master boolean; notify ( explicit | master-only | boolean ); notify-delay integer; notify-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; notify-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; notify-to-soa boolean; pubkey integer integer request-expire boolean; request-ixfr boolean; serial-update-method ( date | increment | unixtime ); server-addresses { ( ipv4_address | ipv6_address ) [ port integer ]; ... }; server-names { quoted_string; ... }; sig-signing-nodes integer; sig-signing-signatures integer; sig-signing-type integer; sig-validity-interval integer [ integer ]; transfer-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; [ dscp integer ]; notify-to-soa boolean; pubkey integer integer request-expire boolean; request-ixfr boolean; serial-update-method ( date | increment | unixtime ); server-addresses { ( ipv4_address | ipv6_address ) [ port integer ]; ... }; server-names { quoted_string; ... }; sig-signing-nodes integer; sig-signing-signatures integer; sig-signing-type integer; sig-validity-interval integer [ integer ]; transfer-source ( ipv4_address | * ) [ port ( integer | * ) ] [ dscp integer ]; transfer-source-v6 ( ipv6_address | * ) [ port ( integer | * ) ] [ dscp integer ]; try-tcp-refresh boolean; type ( delegation-only | forward | hint | master | redirect | slave | static-stub | stub ); update-check-ksk boolean; update-policy ( local | { ( deny | grant ) string ( 6to4-self | external | krb5-self | krb5-subdomain | ms-self | ms-subdomain | name | self | selfsub | selfwild | subdomain | tcp-self | wildcard | zonesub ) [ string ] rrtypelist; ... }; use-alt-transfer-source boolean; zero-no-soa-ttl boolean; zone-statistics ( full | terse | none | boolean );
インストールプログラム
通常プログラム
arpaname
translate IP addresses to the corresponding ARPA names
arpaname
bind9-config
isc-config.shと同じである。
delv
DNS lookup and validation utility
delv
dig
dig [@<問い合わせDNSサーバ>] [+<オプション>] <問い合わせ対象> <ドメイン>
バージョンを確認する
dig @localhost CHAOS version.bind TXTこのコマンドでBINDのバージョンが確認可能である。
脆弱性の露呈になり得るのでバージョン情報は隠すように設定するべきである。
設定はnamed.confに下記のように行う。ダブルクォーテーション内の文字が返されるようになる。
options { version "version"; };
- 設定前
;; ANSWER SECTION: version.bind. 0 CH TXT "9.11.3"
- 設定後
;; ANSWER SECTION: version.bind. 0 CH TXT "version"
host
host
isc-config.sh
インストール時のパスやビルド情報を出力する。
ただし、ソースコードからの再インストールに必要な完全な情報は揃わない。
mdig
DNS pipelined lookup utility
mdig
named-rrchecker
syntax checker for individual DNS resource records
named-rrchecker
nslookup
nslookup
nsupdate
Dynamic DNS update utility
管理プログラム
sbin配下のプログラム
ddns-confgen
ddnsのキーを生成する。
ddns-confgen
dnssec-dsfromkey
dnssec-dsfromkey
dnssec-importkey
dnssec-importkey
dnssec-keyfromlabel
dnssec-keyfromlabel
dnssec-keygen
dnssec-keygen
dnssec-revoke
dnssec-revoke
dnssec-settime
dnssec-settime
dnssec-signzone
dnssec-signzone
dnssec-verify
dnssec-verify
genrandom
ランダムなデータが書き込まれたファイルを生成する。
genrandom <サイズ(KB)> <パス>
isc-hmac-fixup
fixes HMAC keys generated by older versions of BIND
isc-hmac-fixup
lwresd
lightweight resolver daemon
lwresd
named
BINDのデーモンプログラム
named-checkconf
設定ファイル($BIND_HOME/etc/named.conf)のチェックを行う。
- 書式
named-checkconf [<設定ファイルパス>]
- オプション
- -h
使用方法を表示する。
- -h
named-checkzone
ゾーン情報ファイルのチェックを行う。
named-checkzone
named-compilezone
named-checkzoneのエイリアス
named-journalprint
print zone journal in human-readable form
named-journalprint
nsec3hash
generate NSEC3 hash
nsec3hash
rndc
BINDの管理ツール
- 書式
rndc <サブコマンド>
- サブコマンド
- reload
設定ファイル、ゾーンファイルの再読み込みを行う。
rndc reload
- stop
BINDを停止する。
- reload
- サブコマンド
rndc-confgen
rndc-confgen
tsig-keygen
tsig-keygen
運用
トラブルシューティング
起動しない
起動直後にshutting downする
- 事象
次のように起動するが直ちにダウンする。systemctlから起動している。
May 23 11:38:53 dns named[6046]: all zones loaded May 23 11:38:53 dns named[6046]: running May 23 11:38:53 dns named[6046]: shutting down May 23 11:38:53 dns named[6046]: stopping command channel on 127.0.0.1#953 May 23 11:38:53 dns named[6046]: stopping command channel on ::1#953 May 23 11:38:53 dns named[6046]: no longer listening on ::#53 May 23 11:38:53 dns named[6046]: no longer listening on 127.0.0.1#53
- 原因
サービスファイルのTypeがsimpleになっているか、未定義である。
namedプログラムはプロセスがフォークしてバックグラウンドで動作し、呼び出したフォアグラウンドプロセス自体は直ちに終了する。
- 対応方法
サービスファイル(/etc/systemd/system/bind.service)に下記を定義する。
Type=forking
動作試験
- dig axfrでゾーン転送テスト
- rndc statusでrndc接続テスト
- コンフィグテスト
- dig @127.0.0.1 +norec A www.example.co.jp
- dig @127.0.0.1 +norec +multiline SOA example.co.jp
- dig @127.0.0.1 +norec PTR 1.0.0.10.in-addr.arpa.
- digはtcp udp両方テスト
- 再起問い合わせで他社ドメインの解決テスト
- dig @127.0.0.1 CHAOS version.bind TXT