いきなり参考情報
参考情報は以下から。
作業方法
とりあえず上記を参考にして作業を進めていきます。
1. 必要なパッケージを導入する。
$ sudo apt-get install gcc make libssl-dev libevent-dev
2. ソースをダウンロードしてくる。
$ cd /tmp
$ wget http://nlnetlabs.nl/downloads/nsd/nsd-4.0.0b4.tar.gz
3.makeする。
$ tar zxf nsd-4.0.0b4.tar.gz
$ ./configure --prefix=/usr/local --enable-ratelimit \
> --with-configdir=/etc/nsd4 --with-zonesdir=/etc/nsd4/zones \
> --with-user=nsd --with-libevent --with-ssl \
> --with-zonelistfile=/var/cache/nsd4/zone.list \
> --with-dbfile=/var/cache/nsd4/zone.db \
> --with-xfrdfile=/var/cache/nsd4/xfrd.state \
> --with-pidfile=/var/run/nsd4/nsd4.pid \
> --with-logfile=/var/log/nsd4/nsd4.log
$ sudo make
4. make install
する。
$ sudo make install
./install-sh -c -d /usr/local/sbin
./install-sh -c -d /etc/nsd4
./install-sh -c -d /var/run/nsd4
./install-sh -c -d /tmp
./install-sh -c -d /var/cache/nsd4
./install-sh -c -d /usr/local/share/man
./install-sh -c -d /usr/local/share/man/man8
./install-sh -c -d /usr/local/share/man/man5
./install-sh -c nsd /usr/local/sbin/nsd
./install-sh -c nsd-control-setup.sh /usr/local/sbin/nsd-control-setup
./install-sh -c nsd-checkconf /usr/local/sbin/nsd-checkconf
./install-sh -c nsd-control /usr/local/sbin/nsd-control
./install-sh -c -m 644 ./nsd.8 /usr/local/share/man/man8
./install-sh -c -m 644 ./nsd-checkconf.8 /usr/local/share/man/man8/nsd-checkconf.8
./install-sh -c -m 644 ./nsd-control.8 /usr/local/share/man/man8/nsd-control.8
./install-sh -c -m 644 ./nsd.conf.5 /usr/local/share/man/man5/nsd.conf.5
./install-sh -c -m 644 nsd.conf.sample /etc/nsd4/nsd.conf.sample
5. 実行ユーザとグループの作成、およびディレクトリの権限変更。
sudo groupadd -r nsd
sudo useradd -r -d /etc/nsd -M -g nsd nsd
sudo mkdir /etc/nsd4/zones
sudo mkdir /var/log/nsd4
sudo mkdir /etc/nsd4/secondary
sudo chown -R nsd:nsd /etc/nsd4/zones/ /var/cache/nsd4/ /var/log/nsd4 /etc/nsd4/secondary
6. nsd-controlに必要な鍵の生成
$ sudo nsd-control-setup
setup in directory /etc/nsd4
generating nsd_server.key
Generating RSA private key, 1536 bit long modulus
.......................++++
.....++++
e is 65537 (0x10001)
generating nsd_control.key
Generating RSA private key, 1536 bit long modulus
.....................++++
....++++
e is 65537 (0x10001)
create nsd_server.pem (self signed certificate)
create nsd_control.pem (signed client certificate)
Signature ok
subject=/CN=nsd-control
Getting CA Private Key
Setup success. Certificates created. Enable in nsd.conf file to use
7. configを編集する。
sudo cp -p /etc/nsd4/nsd.conf.sample /etc/nsd4/nsd.conf
server:
ip-address: <IPアドレス>
do-ip4: no
do-ip6: no
zonesdir: "/etc/nsd4/zones"
zonelistfile: "/var/cache/nsd4/zone.list"
database: "/var/cache/nsd4/zone.db"
logfile: "/var/log/nsd4/nsd4.log"
pidfile: "/var/run/nsd4/nsd4.pid"
xfrdfile: "/var/cache/nsd4/xfrd.state"
hide-version: yes
remote-control:
control-enable: yes
control-interface: 127.0.0.1
control-interface: ::1
control-port: 8952
server-key-file: "/etc/nsd4/nsd_server.key"
server-cert-file: "/etc/nsd4/nsd_server.pem"
control-key-file: "/etc/nsd4/nsd_control.key"
control-cert-file: "/etc/nsd4/nsd_control.pem"
pattern:
name: "slave"
zonefile: "secondary/%s.zone"
allow-notify: <マスターサーバのIPアドレス> NOKEY
request-xfr: AXFR <マスターサーバのIPアドレス> NOKEY
zone:
name: "kometch.local"
zonefile: "/etc/nsd4/secondary/kometch.local.db.rev"
allow-notify: <マスターサーバのIPアドレス> NOKEY
allow-notify: 127.0.0.1 NOKEY
request-xfr: AXFR <マスターサーバのIPアドレス> NOKEY
allow-axfr-fallback: yes
zone:
name: "1.168.192.in-addr.arpa"
zonefile: "/etc/nsd4/secondary/1.168.192.rev"
allow-notify: <マスターサーバのIPアドレス> NOKEY
allow-notify: 127.0.0.1 NOKEY
request-xfr: AXFR <マスターサーバのIPアドレス> NOKEY
allow-axfr-fallback: yes
8. 実行して、動作を確認する。
$ sudo nsd-control start
$ sudo nsd-control status
version: 4.0.0b4
verbosity: 1
$ sudo nsd-control zonestatus
zone: 1.168.192.in-addr.arpa
state: ok
served-serial: "2013052501 since 2013-06-23T12:34:05"
commit-serial: "2013052501 since 2013-06-23T12:34:05"
zone: kometch.local
state: ok
served-serial: "2013052502 since 2013-06-23T12:39:06"
commit-serial: "2013052502 since 2013-06-23T12:39:06"
$ sudo nsd-control write
ok
$ sudo nsd-control reload
9. プロセスが起動していること確認する。
$ ps -ef | grep nsd
nsd 761 1 0 13:19 ? 00:00:00 nsd -c /etc/nsd4/nsd.conf
nsd 762 761 0 13:19 ? 00:00:00 nsd -c /etc/nsd4/nsd.conf
pi 813 30513 0 13:20 pts/0 00:00:00 grep --color=auto nsd
nsd 2044 1 1 01:59 ? 00:09:26 nsd -c /etc/nsd4/nsd.conf
10. 名前解決ができることを確認する。
# dig @192.168.1.xxxx kvm.kometch.local
; <<>> DiG 9.9.2-P1 <<>> @192.168.1.xxx kvm.kometch.local
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12488
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 5
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;kvm.kometch.local. IN A
;; ANSWER SECTION:
kvm.kometch.local. 600 IN A 192.168.1.aaa
;; AUTHORITY SECTION:
kometch.local. 600 IN NS dns1.kometch.local.
kometch.local. 600 IN NS dns3.kometch.local.
;; ADDITIONAL SECTION:
dns1.kometch.local. 600 IN A 192.168.1.xxx
dns3.kometch.local. 600 IN A 192.168.1.yyy
というわけで、懸念していたRaspberryPiでも無事に導入することが出来ました。