- 论坛徽章:
- 0
|
BIND中的根目录能否为空?
原帖由 "mana" 发表:
如果可以为空的话,假如服务器本地缓存和区域都无法回答一个查询,同时又不可以转发,那么服务器应如何答复客户端?
我条件所限无法测试,望各位不啬赐教,多谢。
1.可以为空
2.服务器回答客户端,无发找到.
[root@gnu123 named]# dig @127.0.0.1 www.chinaunix.com
; <<>;>; DiG 9.2.1 <<>;>; @127.0.0.1 www.chinaunix.com
;; global options: printcmd
;; Got answer:
;; ->;>;HEADER<<- opcode: QUERY, status: SERVFAIL, id: 51266
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.chinaunix.com. IN A
;; Query time: 114 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Mar 12 20:56:20 2005
;; MSG SIZE rcvd: 35
这个是可以转发的.
[root@gnu123 named]# dig @127.0.0.1 www.sohu.com
; <<>;>; DiG 9.2.1 <<>;>; @127.0.0.1 www.sohu.com
;; global options: printcmd
;; Got answer:
;; ->;>;HEADER<<- opcode: QUERY, status: NOERROR, id: 51933
;; flags: qr rd ra; QUERY: 1, ANSWER: 20, AUTHORITY: 3, ADDITIONAL: 3
;; QUESTION SECTION:
;www.sohu.com. IN A
;; ANSWER SECTION:
www.sohu.com. 252 IN CNAME pagegrp1.sohu.com.
pagegrp1.sohu.com. 361 IN A 61.135.131.91
pagegrp1.sohu.com. 361 IN A 61.135.131.180
pagegrp1.sohu.com. 361 IN A 61.135.131.182
pagegrp1.sohu.com. 361 IN A 61.135.131.183
pagegrp1.sohu.com. 361 IN A 61.135.132.65
pagegrp1.sohu.com. 361 IN A 61.135.132.80
pagegrp1.sohu.com. 361 IN A 61.135.132.172
pagegrp1.sohu.com. 361 IN A 61.135.132.173
pagegrp1.sohu.com. 361 IN A 61.135.132.176
pagegrp1.sohu.com. 361 IN A 61.135.133.109
pagegrp1.sohu.com. 361 IN A 61.135.145.47
pagegrp1.sohu.com. 361 IN A 61.135.150.65
pagegrp1.sohu.com. 361 IN A 61.135.150.67
pagegrp1.sohu.com. 361 IN A 61.135.150.75
pagegrp1.sohu.com. 361 IN A 61.135.150.99
pagegrp1.sohu.com. 361 IN A 61.135.150.101
pagegrp1.sohu.com. 361 IN A 61.135.150.113
pagegrp1.sohu.com. 361 IN A 61.135.150.145
pagegrp1.sohu.com. 361 IN A 61.135.131.73
;; AUTHORITY SECTION:
sohu.com. 359 IN NS ns1.sohu.com.
sohu.com. 359 IN NS ns2.sohu.com.
sohu.com. 359 IN NS dns.sohu.com.
;; ADDITIONAL SECTION:
dns.sohu.com. 4331 IN A 61.135.131.86
ns1.sohu.com. 165564 IN A 61.135.131.1
ns2.sohu.com. 172673 IN A
;; Query time: 307 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Mar 12 20:57:06 2005
;; MSG SIZE rcvd: 459
这个是我的转发区.
zone "sohu.com" {
type forward;
forwarders {192.168.1.1;};
forward only;
};
不过有一点不明白.就是关于cache的问题.
1.首先我清楚了cache的内容
[root@gnu123 named]# rndc flush
2.查询了www.chinaunix.com这个域名
[root@gnu123 named]# dig @127.0.0.1 www.chinaunix.com
; <<>;>; DiG 9.2.1 <<>;>; @127.0.0.1 www.chinaunix.com
;; global options: printcmd
;; Got answer:
;; ->;>;HEADER<<- opcode: QUERY, status: NOERROR, id: 62070
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0
;; QUESTION SECTION:
;www.chinaunix.com. IN A
;; ANSWER SECTION:
www.chinaunix.com. 21600 IN A 61.135.136.122
;; AUTHORITY SECTION:
chinaunix.com. 21600 IN NS dns1.hichina.com.
chinaunix.com. 21600 IN NS dns2.hichina.com.
;; Query time: 3780 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Mar 12 21:06:28 2005
;; MSG SIZE rcvd: 97
3.将named.ca清空.重新加载数据rndc reload
产看结果
Mar 12 21:07:56 gnu123 named[2302]: loading configuration from '/etc/named.conf'Mar 12 21:07:56 gnu123 named[2302]: no IPv6 interfaces found
加载成功.
4.查域名www.chinaunix.com
[root@gnu123 named]# dig @127.0.0.1 www.chinaunix.com
; <<>;>; DiG 9.2.1 <<>;>; @127.0.0.1 www.chinaunix.com
;; global options: printcmd
;; Got answer:
;; ->;>;HEADER<<- opcode: QUERY, status: NOERROR, id: 6084
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0
;; QUESTION SECTION:
;www.chinaunix.com. IN A
;; ANSWER SECTION:
www.chinaunix.com. 21391 IN A 61.135.136.122
;; AUTHORITY SECTION:
chinaunix.com. 21391 IN NS dns2.hichina.com.
chinaunix.com. 21391 IN NS dns1.hichina.com.
;; Query time: 92 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Mar 12 21:09:57 2005
;; MSG SIZE rcvd: 97
能得到结果没问题应为有cache
接者查 www.tom.com 应改不会查出来.
结果:
[root@gnu123 named]# dig @127.0.0.1 www.tom.com
; <<>;>; DiG 9.2.1 <<>;>; @127.0.0.1 www.tom.com
;; global options: printcmd
;; Got answer:
;; ->;>;HEADER<<- opcode: QUERY, status: NOERROR, id: 60706
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0
;; QUESTION SECTION:
;www.tom.com. IN A
;; ANSWER SECTION:
www.tom.com. 600 IN A 61.135.158.72
;; AUTHORITY SECTION:
tom.com. 3600 IN NS ns2.tom.com.
tom.com. 3600 IN NS ns1.tom.com.
;; Query time: 1590 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Mar 12 21:11:04 2005
;; MSG SIZE rcvd: 81
有了结果. (疑惑??) 问什么呢 ??
5.rndc flush
在查www.tom.com
[root@gnu123 named]# dig @127.0.0.1 www.tom.com
; <<>;>; DiG 9.2.1 <<>;>; @127.0.0.1 www.tom.com
;; global options: printcmd
;; Got answer:
;; ->;>;HEADER<<- opcode: QUERY, status: SERVFAIL, id: 59646
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.tom.com. IN A
;; Query time: 140 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Mar 12 21:12:49 2005
;; MSG SIZE rcvd: 29
这此就不能查到结果了.
问题:: 为什么能查出www.tom.com 的域名 ?? |
|