いちからやり直し、、、(29)DNS スレーブサーバ

Debian HS-DHGL

延長対応ハック de ダブルまる録!! 外部チューナコントロールつき が動くようになったので、ホームサーバとしてのいろいろ細かな設定を進めていく。

次は、DNS サーバ。
192.168.1.2 でマスタサーバが動いているので、このマシンは スレーブにする。
そのほか、Flets 関連は、192.168.1.1 で動作している CTU に問い合わせる。

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

例によって、どのパッケージをインストールすれば良いのか調べるところから。
yasunari@slam:~$ apt-cache search bind
6tunnel - TCP proxy for non-IPv6 applications
afnix - Compiler and run-time for the AFNIX programming language
afnix-doc - Compiler and run-time for the AFNIX programming language (documentation)
amarok - versatile and easy to use audio player for KDE
apbs - Adaptive Poisson Boltzmann Solver
apertium-dbus - A D-Bus service for the Apertium machine translation system
aplus-fsf-el - XEmacs lisp for A+ development
authbind - Allows non-root programs to bind() to low ports
autodns-dhcp - Automatic DNS updates for DHCP
autodock - analysis of ligand binding to protein structure
autogrid - pre-calculate binding of ligands to their receptor
baycomusb - Drivers for the HB9JNX packet radio usb modem
bibindex - Fast lookup in BibTeX bibliography data bases
bind9 - Internet Domain Name Server
bind9-doc - Documentation for BIND
bind9-host - Version of 'host' bundled with BIND 9.X
bind9utils - Utilities for BIND
bindfs - mirrors or overlays a local directory with altered permissions
bindgraph - DNS statistics RRDtool frontend for BIND9
blender - Very fast and versatile 3D modeller/renderer
	:
	:
bind9 で良さそう。

インストールする。

yasunari@slam:~$ su - root
Password:
slam:~# apt-get install bind9
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  bind9utils libbind9-40 libcap2 libdns45 libisc45 libisccc40 libisccfg40
  liblwres40 libxml2 sgml-base xml-core
Suggested packages:
  dnsutils bind9-doc resolvconf ufw sgml-base-doc debhelper
The following NEW packages will be installed:
  bind9 bind9utils libbind9-40 libcap2 libdns45 libisc45 libisccc40
  libisccfg40 liblwres40 libxml2 sgml-base xml-core
0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded.
Need to get 2034kB of archives.
After this operation, 5239kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.jp.debian.org lenny/main libcap2 2.11-2 [10.9kB]
Get:2 http://ftp.jp.debian.org lenny/main libxml2 2.6.32.dfsg-5 [791kB]
Get:3 http://ftp.jp.debian.org lenny/main libisc45 1:9.5.1.dfsg.P2-1+lenny1 [153kB]
Get:4 http://ftp.jp.debian.org lenny/main libdns45 1:9.5.1.dfsg.P2-1+lenny1 [558kB]
Get:5 http://ftp.jp.debian.org lenny/main libisccc40 1:9.5.1.dfsg.P2-1+lenny1 [26.2kB]
Get:6 http://ftp.jp.debian.org lenny/main libisccfg40 1:9.5.1.dfsg.P2-1+lenny1 [42.5kB]
Get:7 http://ftp.jp.debian.org lenny/main libbind9-40 1:9.5.1.dfsg.P2-1+lenny1 [30.9kB]
Get:8 http://ftp.jp.debian.org lenny/main liblwres40 1:9.5.1.dfsg.P2-1+lenny1 [42.5kB]
Get:9 http://ftp.jp.debian.org lenny/main bind9utils 1:9.5.1.dfsg.P2-1+lenny1 [97.3kB]
Get:10 http://ftp.jp.debian.org lenny/main bind9 1:9.5.1.dfsg.P2-1+lenny1 [247kB]
Get:11 http://ftp.jp.debian.org lenny/main sgml-base 1.26 [11.7kB]
Get:12 http://ftp.jp.debian.org lenny/main xml-core 0.12 [23.1kB]
Fetched 2034kB in 1s (1484kB/s)
Preconfiguring packages ...
Selecting previously deselected package libcap2.
(Reading database ... 12669 files and directories currently installed.)
Unpacking libcap2 (from .../libcap2_2.11-2_armel.deb) ...
Selecting previously deselected package libxml2.
Unpacking libxml2 (from .../libxml2_2.6.32.dfsg-5_armel.deb) ...
Selecting previously deselected package libisc45.
Unpacking libisc45 (from .../libisc45_1%3a9.5.1.dfsg.P2-1+lenny1_armel.deb) ...
Selecting previously deselected package libdns45.
Unpacking libdns45 (from .../libdns45_1%3a9.5.1.dfsg.P2-1+lenny1_armel.deb) ...
Selecting previously deselected package libisccc40.
Unpacking libisccc40 (from .../libisccc40_1%3a9.5.1.dfsg.P2-1+lenny1_armel.deb) ...
Selecting previously deselected package libisccfg40.
Unpacking libisccfg40 (from .../libisccfg40_1%3a9.5.1.dfsg.P2-1+lenny1_armel.deb) ...
Selecting previously deselected package libbind9-40.
Unpacking libbind9-40 (from .../libbind9-40_1%3a9.5.1.dfsg.P2-1+lenny1_armel.deb) ...
Selecting previously deselected package liblwres40.
Unpacking liblwres40 (from .../liblwres40_1%3a9.5.1.dfsg.P2-1+lenny1_armel.deb) ...
Selecting previously deselected package bind9utils.
Unpacking bind9utils (from .../bind9utils_1%3a9.5.1.dfsg.P2-1+lenny1_armel.deb) ...
Selecting previously deselected package bind9.
Unpacking bind9 (from .../bind9_1%3a9.5.1.dfsg.P2-1+lenny1_armel.deb) ...
Selecting previously deselected package sgml-base.
Unpacking sgml-base (from .../sgml-base_1.26_all.deb) ...
Selecting previously deselected package xml-core.
Unpacking xml-core (from .../archives/xml-core_0.12_all.deb) ...
Processing triggers for man-db ...
Setting up libcap2 (2.11-2) ...
Setting up libxml2 (2.6.32.dfsg-5) ...
Setting up libisc45 (1:9.5.1.dfsg.P2-1+lenny1) ...
Setting up libdns45 (1:9.5.1.dfsg.P2-1+lenny1) ...
Setting up libisccc40 (1:9.5.1.dfsg.P2-1+lenny1) ...
Setting up libisccfg40 (1:9.5.1.dfsg.P2-1+lenny1) ...
Setting up libbind9-40 (1:9.5.1.dfsg.P2-1+lenny1) ...
Setting up liblwres40 (1:9.5.1.dfsg.P2-1+lenny1) ...
Setting up bind9utils (1:9.5.1.dfsg.P2-1+lenny1) ...
Setting up bind9 (1:9.5.1.dfsg.P2-1+lenny1) ...
Adding group `bind' (GID 107) ...
Done.
Adding system user `bind' (UID 104) ...
Adding new user `bind' (UID 104) with group `bind' ...
Not creating home directory `/var/cache/bind'.
wrote key file "/etc/bind/rndc.key"
#
Starting domain name service...: bind9.
Setting up sgml-base (1.26) ...
Setting up xml-core (0.12) ...
slam:~#

bind のセットアップ

まずは設定ファイルの様子を見る。
slam:~# cd /etc/bind[TAB][TAB]
bind/                   bindresvport.blacklist
slam:~# cd /etc/bind
slam:/etc/bind# ls
db.0    db.255    db.local  named.conf        named.conf.options  zones.rfc1918
db.127  db.empty  db.root   named.conf.local  rndc.key
slam:/etc/bind# less db.127
いろいろ確認。
ローカルな設定は、named.conf.local に書くのは変っていない。

named.conf.local を待避した上で作る。

slam:/etc/bind# mv named.conf.local{,.orig}
slam:/etc/bind# vi named.conf.local
slam:/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";
};
zone "2.168.192.in-addr.arpa" {
    type slave;
        masters {
                192.168.1.2;
        };
    file "2.168.192-rev.bak";
};
zone "fletsnet.com" {
    type forward;
    forward only;
    forwarders {
        192.168.1.1;
    };
};
zone "flets" {
    type forward;
    forward only;
    forwarders {
        192.168.1.1;
    };
};
zone "194.210.220.in-addr.arpa" {
    type forward;
    forward only;
    forwarders {
        192.168.1.1;
    };
};
slam:/etc/bind#

named の再起動

slam:/etc/bind# /etc/init.d/bind9 restart
Stopping domain name service...: bind9 waiting for pid 12359 to die.
Starting domain name service...: bind9.
slam:/etc/bind#

確認

今や obsolute の(?) nslookup をインストール、
slam:/etc/bind# apt-get install nslookup
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package nslookup
slam:/etc/bind# apt-cache search nslookup
dnsutils - Clients provided with BIND
host - utility for querying DNS servers
slam:/etc/bind# apt-get install dnsutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  bind9-host
Suggested packages:
  rblcheck
The following NEW packages will be installed:
  bind9-host dnsutils
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 215kB of archives.
After this operation, 528kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.jp.debian.org lenny/main bind9-host 1:9.5.1.dfsg.P2-1+lenny1 [63.4kB]
Get:2 http://ftp.jp.debian.org lenny/main dnsutils 1:9.5.1.dfsg.P2-1+lenny1 [151kB]
Fetched 215kB in 0s (272kB/s)
Selecting previously deselected package bind9-host.
(Reading database ... 12833 files and directories currently installed.)
Unpacking bind9-host (from .../bind9-host_1%3a9.5.1.dfsg.P2-1+lenny1_armel.deb) ...
Selecting previously deselected package dnsutils.
Unpacking dnsutils (from .../dnsutils_1%3a9.5.1.dfsg.P2-1+lenny1_armel.deb) ...
Processing triggers for man-db ...
Setting up bind9-host (1:9.5.1.dfsg.P2-1+lenny1) ...
Setting up dnsutils (1:9.5.1.dfsg.P2-1+lenny1) ...
slam:/etc/bind#
簡単に確認する。
slam:/etc/bind# nslookup
> server localhost
Default server: localhost
Address: 127.0.0.1#53
> 192.168.1.2
Server:         localhost
Address:        127.0.0.1#53

2.1.168.192.in-addr.arpa        name = ns.yamasita.jp.
> ns.yamasita.jp.
Server:         localhost
Address:        127.0.0.1#53

Name:   ns.yamasita.jp
Address: 192.168.1.2
> 192.168.2.23
Server:         localhost
Address:        127.0.0.1#53

23.2.168.192.in-addr.arpa       name = mebiusl.yamasita.jp.
> mebiusl.yamasita.jp.
Server:         localhost
Address:        127.0.0.1#53

Name:   mebiusl.yamasita.jp
Address: 192.168.2.23
> google.co.jp.
Server:         localhost
Address:        127.0.0.1#53

Non-authoritative answer:
Name:   google.co.jp
Address: 72.14.203.104
Name:   google.co.jp
Address: 74.125.91.104
Name:   google.co.jp
Address: 74.125.95.104
> 72.14.203.104
Server:         localhost
Address:        127.0.0.1#53

Non-authoritative answer:
104.203.14.72.in-addr.arpa      name = tx-in-f104.google.com.

Authoritative answers can be found from:
203.14.72.in-addr.arpa  nameserver = NS1.google.com.
203.14.72.in-addr.arpa  nameserver = NS3.google.com.
203.14.72.in-addr.arpa  nameserver = NS2.google.com.
203.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
> set q=mx
> yamasita.jp.
Server:         localhost
Address:        127.0.0.1#53

yamasita.jp     mail exchanger = 1 ns.yamasita.jp.
>
外向きセグメントも、内セグメントも、外も引けているようだ。


HS-DHGL
バッファローダイレクト
楽天市場
Yahoo!ショッピング
ValuMore!
ムラウチドットコム


いちからやり直し、、、(28)DHCP サーバ
ハックの記録
LinkStation/玄箱 をハックしよう

いちからやり直し、、、(30)引っ越し

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