原创作品,允许转载,转载时请务必以超链接形式标明文章
原始出处 、作者信息和本声明。否则将追究法律责任。
http://navyaijm.blog.51cto.com/4647068/1310504
1
|
yum install -y bind bind-chroot ypbind bind-utils
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
vi /etc/named.conf
options {
listen-on port
53
{ any; };
listen-on-v6 port
53
{ ::
1
; };
directory
"/data/named"
;
dump-file
"/data/named/data/cache_dump.db"
;
statistics-file
"/data/named/data/named_stats.txt"
;
memstatistics-file
"/data/named/data/named_mem_stats.txt"
;
allow-query { any; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
# bindkeys-file
"/etc/named.iscdlv.key"
;
# managed-keys-directory
"/data/named/dynamic"
;
};
logging {
channel default_debug {
file
"data/query.log"
;
severity
dynamic
;
};
};
zone
"."
IN {
type hint;
file
"named.ca"
;
};
include
"/etc/named.rfc1912.zones"
;
zone
"navy.com"
{ ##定义正向区域
type master;
file
"/etc/named/navy.com"
; ##正向区域配置文件
};
zone
"2.10.10.in-addr.arpa"
{ ##定义反向区域
type master;
file
"/etc/named/navy.com.arpa"
; ##反向区域配置文件
};
|
1
2
3
4
5
6
7
8
9
10
11
|
vi /etc/named/navy.com
$TTL
86400
@ IN SOA www.navy.com. root.navy.com. ( ; 开始设定内容
2013060505
; 序号/版本号,主要用于主从同步,值大则会更新
8H ; 备用DNS服务器主动更新时间间隔
2H ; 备用服务器更新失败后,重试时间
4W ; 超时时间,超时后备用服务器不再尝试连接主服务器
1D) ; 即TTL,当无TTL设置时取此值
;
@ IN NS www.navy.com.
www IN A
10.10
.
2.201
|
1
2
3
4
5
6
7
8
9
10
11
|
vi /etc/named/navy.com.arpa
$TTL
86400
@ IN SOA
2.10
.
10
.
in
-addr.arpa. root.navy.com. ( ; 开始设定内容
2013060505
; 序号/版本号,主要用于主从同步,值大则会更新
8H ; 备用DNS服务器主动更新时间间隔
2H ; 备用服务器更新失败后,重试时间
4W ; 超时时间,超时后备用服务器不再尝试连接主服务器
1D) ; 即TTL,当无TTL设置时取此值
;
@ IN NS www.navy.com.
201
IN PTR www.navy.com.
|
1
2
3
4
5
6
|
mkdir /data/named
cp -r /
var
/named/* /data/named/
chmod
777
/
var
/run/named/ -R
chown root:root /data/named/ -R
rndc-confgen -r /dev/urandom -a #不执行启动会报错
named -c /etc/named.conf 服务启动
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
root@yw-
0
-
0
~]# dig @
10.10
.
2.201
www.navy.com
; <<>> DiG
9.8
.2rc1-RedHat-
9.8
.
2
-
0.17
.rc1.el6_4.
4
<<>> @
10.10
.
2.201
www.navy.com
; (
1
server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id:
4473
;; flags: qr aa rd ra; QUERY:
1
, ANSWER:
1
, AUTHORITY:
1
, ADDITIONAL:
0
;; QUESTION SECTION:
;www.navy.com. IN A
;; ANSWER SECTION:
www.navy.com.
86400
IN A
10.10
.
2.201
;; AUTHORITY SECTION:
navy.com.
86400
IN NS www.navy.com.
;; Query time:
0
msec
;; SERVER:
10.10
.
2.201
#
53
(
10.10
.
2.201
)
;; WHEN: Thu Oct
17
18
:
11
:
24
2013
;; MSG SIZE rcvd:
60
[root@yw-
0
-
0
~]# dig @
10.10
.
2.201
201.2
.
10.10
.
in
-addr.arpa ptr
; <<>> DiG
9.8
.2rc1-RedHat-
9.8
.
2
-
0.17
.rc1.el6_4.
4
<<>> @
10.10
.
2.201
201.2
.
10.10
.
in
-addr.arpa ptr
; (
1
server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id:
52197
;; flags: qr aa rd ra; QUERY:
1
, ANSWER:
1
, AUTHORITY:
1
, ADDITIONAL:
1
;; QUESTION SECTION:
;
201.2
.
10.10
.
in
-addr.arpa. IN PTR
;; ANSWER SECTION:
201.2
.
10.10
.
in
-addr.arpa.
86400
IN PTR www.navy.com.
;; AUTHORITY SECTION:
2.10
.
10
.
in
-addr.arpa.
86400
IN NS www.navy.com.
;; ADDITIONAL SECTION:
www.navy.com.
86400
IN A
10.10
.
2.201
;; Query time:
0
msec
;; SERVER:
10.10
.
2.201
#
53
(
10.10
.
2.201
)
;; WHEN: Thu Oct
17
18
:
11
:
33
2013
;; MSG SIZE rcvd:
98
|