セカンダリ DNS サーバ

HS-DHGL

と ある理由で HS-DHGL で 内向きセカンダリ DNS サーバを立てることになった。

インストールするパッケージは?

いつも通り、インストールするパッケージを探す。
sil:~# apt-cache search named
とか
sil:~# apt-cache search domain
とか
sil:~# apt-cache search bind
とかやってみたが、たくさん出て、、、どうやら
bind9 - Internet Domain Name Server
みたい。

bind9 パッケージのインストール

sil:~# apt-get update
	:
	:
sil:~# apt-get install bind9
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
  libbind9-0 libdns22 libisc11 libisccc0 libisccfg1 liblwres9
Suggested packages:
  dnsutils bind9-doc
The following NEW packages will be installed:
  bind9 libbind9-0 libdns22 libisc11 libisccc0 libisccfg1 liblwres9
0 upgraded, 7 newly installed, 0 to remove and 8 not upgraded.
Need to get 1434kB of archives.
After unpacking 3887kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp2.jp.debian.org proposed-updates/main libisc11 1:9.3.4-2etch1 [182kB]
Get:2 http://ftp2.jp.debian.org proposed-updates/main libdns22 1:9.3.4-2etch1 [534kB]
Get:3 http://ftp2.jp.debian.org proposed-updates/main libisccc0 1:9.3.4-2etch1 [94.9kB]
Get:4 http://ftp2.jp.debian.org proposed-updates/main libisccfg1 1:9.3.4-2etch1 [107kB]
Get:5 http://ftp2.jp.debian.org proposed-updates/main libbind9-0 1:9.3.4-2etch1 [94.3kB]
Get:6 http://ftp2.jp.debian.org proposed-updates/main liblwres9 1:9.3.4-2etch1 [112kB]
Get:7 http://ftp2.jp.debian.org proposed-updates/main bind9 1:9.3.4-2etch1 [309kB]
Fetched 1434kB in 1s (944kB/s)
Selecting previously deselected package libisc11.
(Reading database ... 14353 files and directories currently installed.)
Unpacking libisc11 (from .../libisc11_1%3a9.3.4-2etch1_arm.deb) ...
Selecting previously deselected package libdns22.
Unpacking libdns22 (from .../libdns22_1%3a9.3.4-2etch1_arm.deb) ...
Selecting previously deselected package libisccc0.
Unpacking libisccc0 (from .../libisccc0_1%3a9.3.4-2etch1_arm.deb) ...
Selecting previously deselected package libisccfg1.
Unpacking libisccfg1 (from .../libisccfg1_1%3a9.3.4-2etch1_arm.deb) ...
Selecting previously deselected package libbind9-0.
Unpacking libbind9-0 (from .../libbind9-0_1%3a9.3.4-2etch1_arm.deb) ...
Selecting previously deselected package liblwres9.
Unpacking liblwres9 (from .../liblwres9_1%3a9.3.4-2etch1_arm.deb) ...
Selecting previously deselected package bind9.
Unpacking bind9 (from .../bind9_1%3a9.3.4-2etch1_arm.deb) ...
Setting up libisc11 (9.3.4-2etch1) ...

Setting up libdns22 (9.3.4-2etch1) ...

Setting up libisccc0 (9.3.4-2etch1) ...

Setting up libisccfg1 (9.3.4-2etch1) ...

Setting up libbind9-0 (9.3.4-2etch1) ...

Setting up liblwres9 (9.3.4-2etch1) ...

Setting up bind9 (9.3.4-2etch1) ...
Adding group `bind' (GID 106) ...
Done.
Adding system user `bind' (UID 101) ...
Adding new user `bind' (UID 101) with group `bind' ...
Not creating home directory `/var/cache/bind'.
wrote key file "/etc/bind/rndc.key"
Starting domain name service...: bind.

sil:~#

bind の設定

設定方法

さて、、、どこから設定していけば良いのやら。

named.conf が /etc にあるかと思っていたが、、、

sil:~# ls /etc/named.conf
ls: /etc/named.conf: No such file or directory
sil:~#
man すると
sil:~# man named
	:
	:
       -c config-file
          Use config-file as the configuration file instead of the default, /etc/bind/named.conf. To ensure that
          reloading the configuration file continues to work after the server has changed its working directory due
          to to a possible directory option in the configuration file, config-file should be an absolute pathname.

/etc/bind にありそう。
sil:~# ls -l /etc/bind
total 44
-rw-r--r-- 1 root root  237 Jul 25 18:37 db.0
-rw-r--r-- 1 root root  271 Jul 25 18:37 db.127
-rw-r--r-- 1 root root  237 Jul 25 18:37 db.255
-rw-r--r-- 1 root root  353 Jul 25 18:37 db.empty
-rw-r--r-- 1 root root  256 Jul 25 18:37 db.local
-rw-r--r-- 1 root root 1507 Jul 25 18:37 db.root
-rw-r--r-- 1 root bind 1611 Jul 25 18:37 named.conf
-rw-r--r-- 1 root bind  165 Jul 25 18:37 named.conf.local
-rw-r--r-- 1 root bind  695 Jul 25 18:37 named.conf.options
-rw-r----- 1 bind bind   77 Nov 11 10:44 rndc.key
-rw-r--r-- 1 root root 1317 Jul 25 18:37 zones.rfc1918
sil:~#
named.conf を見てみると
sil:~# less /etc/bind/named.conf
	:
	:
include "/etc/bind/named.conf.local";
(END)
となっているので、ローカルな設定は /etc/bind/named.conf.local に書けば良さそう。

named.conf.local の記述

sil:~# cd /etc/bind/
sil:/etc/bind# mv named.conf.local named.conf.local.orig
sil:/etc/bind# cp named.conf.local.orig named.conf.local
sil:/etc/bind# vi named.conf.local
	:
sil:/etc/bind# cat named.conf.local
zone "yamasita.jp" {
    type slave;
        masters {
                192.168.1.2;
        };
    file "yamasita.jp-in-zone.bak";
};

zone "1.168.192.in-addr.arpa" {
    type slave;
        masters {
                192.168.1.2;
        };
    file "1.168.192-rev.bak";
};
sil:/etc/bind#
こんなところか?

bind の再起動

sil:/etc/bind# /etc/init.d/bind9 restart
Stopping domain name service...: bind.
Starting domain name service...: bind.
sil:/etc/bind#
ログを見てみる
sil:/etc/bind# less /var/log/daemon.log
	:
	:
Nov 11 11:05:11 sil named[23819]: shutting down: flushing changes
Nov 11 11:05:11 sil named[23819]: stopping command channel on 127.0.0.1#953
Nov 11 11:05:11 sil named[23819]: no longer listening on 192.168.1.39#53
Nov 11 11:05:11 sil named[23819]: no longer listening on 127.0.0.1#53
Nov 11 11:05:11 sil named[23817]: exiting
Nov 11 11:05:14 sil named[26728]: starting BIND 9.3.4 -u bind
Nov 11 11:05:14 sil named[26728]: found 1 CPU, using 1 worker thread
Nov 11 11:05:14 sil named[26730]: loading configuration from '/etc/bind/named.conf'
Nov 11 11:05:14 sil named[26730]: no IPv6 interfaces found
Nov 11 11:05:14 sil named[26730]: listening on IPv4 interface eth0, 192.168.1.39#53
Nov 11 11:05:14 sil named[26730]: listening on IPv4 interface lo, 127.0.0.1#53
Nov 11 11:05:14 sil named[26730]: command channel listening on 127.0.0.1#953
Nov 11 11:05:14 sil named[26730]: zone 0.in-addr.arpa/IN: loaded serial 1
Nov 11 11:05:14 sil named[26730]: zone 127.in-addr.arpa/IN: loaded serial 1
Nov 11 11:05:14 sil named[26730]: zone 255.in-addr.arpa/IN: loaded serial 1
Nov 11 11:05:14 sil named[26730]: zone localhost/IN: loaded serial 1
Nov 11 11:05:14 sil named[26730]: running
Nov 11 11:05:14 sil named[26730]: zone 1.168.192.in-addr.arpa/IN: Transfer started.
Nov 11 11:05:14 sil named[26730]: transfer of '1.168.192.in-addr.arpa/IN' from 192.168.1.2#53: connected using 192.168.1.39#4128
Nov 11 11:05:14 sil named[26730]: zone 1.168.192.in-addr.arpa/IN: transferred serial 2007042101
Nov 11 11:05:14 sil named[26730]: transfer of '1.168.192.in-addr.arpa/IN' from 192.168.1.2#53: end of transfer
Nov 11 11:05:14 sil named[26730]: zone 1.168.192.in-addr.arpa/IN: sending notifies (serial 2007042101)
Nov 11 11:05:14 sil named[26730]: zone yamasita.jp/IN: Transfer started.
Nov 11 11:05:14 sil named[26730]: transfer of 'yamasita.jp/IN' from 192.168.1.2#53: connected using 192.168.1.39#3326
Nov 11 11:05:14 sil named[26730]: zone yamasita.jp/IN: transferred serial 2007042101
Nov 11 11:05:14 sil named[26730]: transfer of 'yamasita.jp/IN' from 192.168.1.2#53: end of transfer
Nov 11 11:05:14 sil named[26730]: zone yamasita.jp/IN: sending notifies (serial 2007042101)
	:
	:
行けてるみたい。

確認

nslookup (汗)で確認する。
sil:~# nslookup
-su: nslookup: command not found
sil:~#
あら、無い。
ほかのマシンから確認する。
[root@ns root]# nslookup
> server 192.168.1.39
Default server: 192.168.1.39
Address: 192.168.1.39#53
> yamasita.jp.
Server:         192.168.1.39
Address:        192.168.1.39#53

Name:   yamasita.jp
Address: 192.168.1.2
> 192.168.1.2
Server:         192.168.1.39
Address:        192.168.1.39#53

2.1.168.192.in-addr.arpa        name = ns.yamasita.jp.
> google.co.jp.
Server:         192.168.1.39
Address:        192.168.1.39#53

Non-authoritative answer:
Name:   google.co.jp
Address: 72.14.203.104
Name:   google.co.jp
Address: 72.14.207.104
Name:   google.co.jp
Address: 72.14.235.104
> 72.14.235.104
Server:         192.168.1.39
Address:        192.168.1.39#53

Non-authoritative answer:
104.235.14.72.in-addr.arpa      name = tw-in-f104.google.com.

Authoritative answers can be found from:
235.14.72.in-addr.arpa  nameserver = ns1.google.com.
235.14.72.in-addr.arpa  nameserver = ns2.google.com.
235.14.72.in-addr.arpa  nameserver = ns3.google.com.
235.14.72.in-addr.arpa  nameserver = ns4.google.com.
ns1.google.com  internet address = 216.239.32.10
ns2.google.com  internet address = 216.239.34.10
ns3.google.com  internet address = 216.239.36.10
ns4.google.com  internet address = 216.239.38.10
>
[root@ns root]#
いけてそう。


HS-DH320GL
楽天市場
Yahoo!ショッピング
somap.com
TSUKUMO ネットショップ
ValuMore!
ムラウチドットコム
アット・ニフティストア icon
Joshin web icon


関西オープンソース2007/関西コミュニティ大決戦 終了
ハックの記録
LinkStation/玄箱 をハックしよう

LS-GL も玄箱/Pro ベースに

Copyright (C) 2003-2007 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市