DNSサーバを構築する!CentOS3でBINDのインストールなど

まず、DNSのソフトウェアであるBINDをインストール

# yum -y install bind

Gathering header information file(s) from server(s)
Server: CentOS-3 - Addons
Server: CentOS-3 - Base
Server: CentOS-3 - Extras
Server: CentOS-3 - Updates
Finding updated packages
Downloading needed headers
Resolving dependencies
.Dependencies resolved
I will do the following:
[install: bind 20:9.2.4-21.el3.i386]
I will install/upgrade these to satisfy the dependencies:
[deps: bind-libs 20:9.2.4-21.el3.i386]
Downloading Packages
Getting bind-9.2.4-21.el3.i386.rpm
bind-9.2.4-21.el3.i386.rp 100% |=========================| 576 kB 00:03
Getting bind-libs-9.2.4-21.el3.i386.rpm
bind-libs-9.2.4-21.el3.i3 100% |=========================| 551 kB 00:02
Running test transaction:
Test transaction complete, Success!
bind-libs 100 % done 1/3
bind 100 % done 2/3
Completing update for bind-libs - 3/3
Installed: bind 20:9.2.4-21.el3.i386
Dep Installed: bind-libs 20:9.2.4-21.el3.i386
Transaction(s) Complete

成功!!

次にクライアントからの問い合わせを処理するためにキャッシングネームサーバパッケージをインストール

# yum -y install caching-nameserver

Gathering header information file(s) from server(s)
Server: CentOS-3 - Addons
Server: CentOS-3 - Base
Server: CentOS-3 - Extras
Server: CentOS-3 - Updates
Finding updated packages
Downloading needed headers
Resolving dependencies
Dependencies resolved
I will do the following:
[install: caching-nameserver 7.3-3_EL3.noarch]
Downloading Packages
Getting caching-nameserver-7.3-3_EL3.noarch.rpm
caching-nameserver-7.3-3_ 100% |=========================| 22 kB 00:00
Running test transaction:
Test transaction complete, Success!
warning: /etc/named.conf saved as /etc/named.conf.rpmorig
caching-nameserver 100 % done 1/1
Installed: caching-nameserver 7.3-3_EL3.noarch

成功!!

次にきちんと動いているか確認

# ps aux | grep named
named 1736 0.0 1.6 36308 3088 ? S 06:23 0:00 /usr/sbin/named -u named
root 1811 0.0 0.3 4700 696 pts/0 S 06:47 0:00 grep named


次にDNSサーバとして自動的に起動するように設定

# chkconfig named on

# chkconfig --list | grep named
named 0:オフ 1:オフ 2:オン 3:オン 4:オン 5:オン 6:オフ

次にきちんと動作するかnslookupで確認
/etc/resolv.confに下記を追加
nameserver 127.0.0.1

# nslookup
>yahoo.co.jp
Server: 127.0.0.1
Address: 127.0.0.1#53

Non-authoritative answer:
Name: yahoo.co.jp
Address: 124.83.139.192
Name: yahoo.co.jp
Address: 203.216.227.176

こちらもうまくいっている様子。