マックの趣味

FreeBSDでnameサーバ

FreeBSDでnamedを動かしてみます。
参考URL
http://www.fkimura.com/bind9-5.html
http://www.bsddiary.net/doc/bind9.html
http://www.ocn.ad.jp/tw/dns_02.html

[svr-root]::/usr/sbin/named -v
BIND 9.3.2
が標準で入っているようです。

自サーバIPを最初に見る nameserver に設定する。

[svr-root]::cat resolv.conf
domain sample.com
nameserver 127.0.0.1  #追加
nameserver 192.168.1.14

動作させるためには named_enable="YES" にすればいいというのがわかりますので、これを /etc/rc.confに追加しておきます。

ルートゾーンファイルはダウンロードします。
named.root

以下に設定ファイルを書いておきます。

//======================================
// /etc/named.conf
//======================================
//options sets global set
// - directory points each directory of files.
// - allow-transfer shows Network and host can be allowed to transfer zone
options {
directory "/etc/namedb";
allow-transfer {
192.168.1.0/24; //prvate address for local
192.168.1.254/32; //secondly DNS
} ;
} ;
//root cache file
zone "." {
type hint;
file "master/named.root";
} ;
//loopback address
zone "0.0.127.in-addr.arpa" {
type master;
file "master/0.0.127.in-addr.arpa.rev";
} ;

//[sample.com]primary zone
zone "sample.com" {
type master;
file "master/sample.com.zone";
} ;
//Network[192.168.1.0/24]

zone "0.1.168.192.in-addr.arpa" {
type master;
file "master/0.1.168.192.in-addr.arpa.rev";
} ;

;sample.com.zone
;For inside
$TTL 3600
;$ORIGIN sample.com.
@ IN SOA svr.sample.com. root.svr.sample.com. (
1 ;Serial
3600 ;Refresh 3 hours
3600 ;Retry 1 hours
864000 ;Expire 10 day
86400 ) ;Minimum 1 day

IN NS svr.sample.com.
IN MX 10 mail.sample.com.
localhost IN A 127.0.0.1
ns IN A 192.168.1.15
mail IN A 192.168.1.15
www IN A 192.168.1.15

;; host
svr IN A 192.168.1.15
svr2 IN A 192.168.1.14
news IN CNAME svr.sample.com.
ftp IN CNAME svr.sample.com.
proxy IN CNAME svr.sample.com.

;; pc
svr IN A 192.168.1.15
svr2 IN A 192.168.1.14
mfc150c IN A 192.168.1.20
saya IN A 192.168.1.1
imac IN A 192.168.1.2
mackpc IN A 192.168.1.3
trim IN A 192.168.1.4
sotec IN A 192.168.1.5
ibook IN A 192.168.1.6
dhcp0 IN A 192.168.1.100
dhcp1 IN A 192.168.1.101
dhcp2 IN A 192.168.1.102
dhcp3 IN A 192.168.1.103
dhcp4 IN A 192.168.1.104
dhcp5 IN A 192.168.1.105
dhcp6 IN A 192.168.1.106
dhcp7 IN A 192.168.1.107
dhcp8 IN A 192.168.1.108
dhcp9 IN A 192.168.1.109
dhcp10 IN A 192.168.1.110
dhcp11 IN A 192.168.1.111
dhcp12 IN A 192.168.1.112
dhcp13 IN A 192.168.1.113
dhcp14 IN A 192.168.1.114
dhcp15 IN A 192.168.1.115
dhcp16 IN A 192.168.1.116
dhcp17 IN A 192.168.1.117
dhcp18 IN A 192.168.1.118
dhcp19 IN A 192.168.1.119
dhcp20 IN A 192.168.1.120

;1.158.192.in-addr.arpa.rev
;For inside
$TTL 86400
@ IN SOA svr.sample.com. root.svr.sample.com. (
1 ;Serial
10800 ;Refresh 3 hours
3600 ;Retry 1 hours
864000 ;Expire 10 day
86400 ;Minimum 1 day
)
IN NS svr.sample.com.
1 IN PTR svr.sample.com.
;; host
20 IN PTR mfc150cl.sample.com.
15 IN PTR svr.sample.com.
14 IN PTR svr2.sample.com.

;; pc
1 IN PTR saya.sample.com.
2 IN PTR imac.sample.com.
3 IN PTR mackpc.sample.com.
4 IN PTR trim.sample.com.
5 IN PTR sotec.sample.com.
6 IN PTR ibook.sample.com.
;;dhcp
100 IN PTR dhcp0.sample.com.
101 IN PTR dhcp1.sample.com.
102 IN PTR dhcp2.sample.com.
103 IN PTR dhcp3.sample.com.
104 IN PTR dhcp4.sample.com.
105 IN PTR dhcp5.sample.com.
106 IN PTR dhcp6.sample.com.
107 IN PTR dhcp7.sample.com.
108 IN PTR dhcp8.sample.com.
109 IN PTR dhcp9.sample.com.
110 IN PTR dhcp10.sample.com.
111 IN PTR dhcp11.sample.com.
112 IN PTR dhcp12.sample.com.
113 IN PTR dhcp13.sample.com.
114 IN PTR dhcp14.sample.com.
115 IN PTR dhcp15.sample.com.
116 IN PTR dhcp16.sample.com.
117 IN PTR dhcp17.sample.com.
118 IN PTR dhcp18.sample.com.
119 IN PTR dhcp19.sample.com.
120 IN PTR dhcp19.sample.com.

; From: @(#)localhost.rev 5.1 (Berkeley) 6/30/90
; $FreeBSD: src/etc/namedb/PROTO.localhost.rev,v 1.6 2000/01/10 15:31:40 peter Exp $
;
; This file is automatically edited by the `make-localhost' script in
; the /etc/namedb directory.
;

$TTL 3600

@ IN SOA svr.sample. root.svr.sample. (
20060820 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
IN NS svr.sample.
1 IN PTR localhost.sample.

ランキングに参加中、クリックをお願いします。

名前:
コメント:

※文字化け等の原因になりますので顔文字の投稿はお控えください。

コメント利用規約に同意の上コメント投稿を行ってください。

 

  • Xでシェアする
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

最新の画像もっと見る

最近の「FreeBSD」カテゴリーもっと見る

最近の記事
バックナンバー
人気記事