Domain-Name-System

命名找不到某個域

  • December 22, 2014

我已經安裝namedchroot,它已經工作了幾天。現在它沒有找到某個域的IP:

# dig arstechnica.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.1 <<>> arstechnica.com
;; global options: +cmd
;; connection timed out; no servers could be reached

通常會發現其他域:

# dig serverfault.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.1 <<>> serverfault.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27016
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:
;serverfault.com.       IN  A

;; ANSWER SECTION:
serverfault.com.    98  IN  A   198.252.206.140

;; AUTHORITY SECTION:
serverfault.com.    172598  IN  NS  cf-dns02.serverfault.com.
serverfault.com.    172598  IN  NS  cf-dns01.serverfault.com.

;; ADDITIONAL SECTION:
cf-dns02.serverfault.com. 172598 IN A   173.245.59.4
cf-dns01.serverfault.com. 172598 IN A   173.245.58.53

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Dec 22 11:06:10 2014
;; MSG SIZE  rcvd: 127

named.conf:

# cat /var/named/chroot/var/named/chroot/etc/named.conf 

options {
   listen-on port 53 { 127.0.0.1; };
   listen-on-v6 port 53 { ::1; };
   directory   "/var/named";
   dump-file   "/var/named/data/cache_dump.db";
   statistics-file "/var/named/data/named_stats.txt";
   memstatistics-file "/var/named/data/named_mem_stats.txt";
   allow-query     { localhost; };
   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 "/var/named/dynamic";
};

logging {
   channel default_debug {
       file "data/named.run";
       severity dynamic;
   };
};

zone "." IN {
   type hint;
   file "named.ca";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

該目錄中的所有文件:

# ll /var/named/chroot/var/named/chroot/etc/
total 16
-rw-r--r--. 1 root root   118 Jul 21  2011 localtime
drwxr-x---. 2 root named 4096 Dec 12 02:25 named
-rw-r-----. 1 root named 1008 Dec 17 20:02 named.conf
-rw-r--r--. 1 root root     0 Dec 22 10:35 named.iscdlv.key
-rw-r--r--. 1 root root     0 Dec 22 10:35 named.rfc1912.zones
-rw-r--r--. 1 root root     0 Dec 22 10:35 named.root.key
drwxr-x---. 3 root named 4096 Dec 17 19:15 pki
-rw-r--r--. 1 root root     0 Dec 22 10:35 rndc.key

我錯過了什麼?


+trace添加:

# dig arstechnica.com +trace

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.1 <<>> arstechnica.com +trace
;; global options: +cmd
.           516879  IN  NS  m.root-servers.net.
.           516879  IN  NS  h.root-servers.net.
.           516879  IN  NS  g.root-servers.net.
.           516879  IN  NS  j.root-servers.net.
.           516879  IN  NS  a.root-servers.net.
.           516879  IN  NS  l.root-servers.net.
.           516879  IN  NS  e.root-servers.net.
.           516879  IN  NS  f.root-servers.net.
.           516879  IN  NS  k.root-servers.net.
.           516879  IN  NS  b.root-servers.net.
.           516879  IN  NS  d.root-servers.net.
.           516879  IN  NS  i.root-servers.net.
.           516879  IN  NS  c.root-servers.net.
;; Received 228 bytes from 127.0.0.1#53(127.0.0.1) in 577 ms

com.            172800  IN  NS  m.gtld-servers.net.
com.            172800  IN  NS  l.gtld-servers.net.
com.            172800  IN  NS  k.gtld-servers.net.
com.            172800  IN  NS  j.gtld-servers.net.
com.            172800  IN  NS  i.gtld-servers.net.
com.            172800  IN  NS  h.gtld-servers.net.
com.            172800  IN  NS  g.gtld-servers.net.
com.            172800  IN  NS  f.gtld-servers.net.
com.            172800  IN  NS  e.gtld-servers.net.
com.            172800  IN  NS  d.gtld-servers.net.
com.            172800  IN  NS  c.gtld-servers.net.
com.            172800  IN  NS  b.gtld-servers.net.
com.            172800  IN  NS  a.gtld-servers.net.
;; Received 493 bytes from 192.58.128.30#53(192.58.128.30) in 2270 ms

arstechnica.com.    172800  IN  NS  ns1.servercentral.net.
arstechnica.com.    172800  IN  NS  ns2.servercentral.net.
;; Received 118 bytes from 192.12.94.30#53(192.12.94.30) in 579 ms

;; connection timed out; no servers could be reached

挖到github:

# dig github.com +trace

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.1 <<>> github.com +trace
;; global options: +cmd
.           516495  IN  NS  k.root-servers.net.
.           516495  IN  NS  e.root-servers.net.
.           516495  IN  NS  f.root-servers.net.
.           516495  IN  NS  b.root-servers.net.
.           516495  IN  NS  g.root-servers.net.
.           516495  IN  NS  d.root-servers.net.
.           516495  IN  NS  m.root-servers.net.
.           516495  IN  NS  c.root-servers.net.
.           516495  IN  NS  j.root-servers.net.
.           516495  IN  NS  h.root-servers.net.
.           516495  IN  NS  a.root-servers.net.
.           516495  IN  NS  i.root-servers.net.
.           516495  IN  NS  l.root-servers.net.
;; Received 508 bytes from 127.0.0.1#53(127.0.0.1) in 5 ms

com.            172800  IN  NS  a.gtld-servers.net.
com.            172800  IN  NS  b.gtld-servers.net.
com.            172800  IN  NS  c.gtld-servers.net.
com.            172800  IN  NS  d.gtld-servers.net.
com.            172800  IN  NS  e.gtld-servers.net.
com.            172800  IN  NS  f.gtld-servers.net.
com.            172800  IN  NS  g.gtld-servers.net.
com.            172800  IN  NS  h.gtld-servers.net.
com.            172800  IN  NS  i.gtld-servers.net.
com.            172800  IN  NS  j.gtld-servers.net.
com.            172800  IN  NS  k.gtld-servers.net.
com.            172800  IN  NS  l.gtld-servers.net.
com.            172800  IN  NS  m.gtld-servers.net.
;; Received 488 bytes from 193.0.14.129#53(193.0.14.129) in 74 ms

github.com.     172800  IN  NS  ns1.p16.dynect.net.
github.com.     172800  IN  NS  ns3.p16.dynect.net.
github.com.     172800  IN  NS  ns2.p16.dynect.net.
github.com.     172800  IN  NS  ns4.p16.dynect.net.
;; Received 178 bytes from 192.31.80.30#53(192.31.80.30) in 323 ms

github.com.     30  IN  A   192.30.252.131
github.com.     86400   IN  NS  ns4.p16.dynect.net.
github.com.     86400   IN  NS  ns2.p16.dynect.net.
github.com.     86400   IN  NS  ns1.p16.dynect.net.
github.com.     86400   IN  NS  ns3.p16.dynect.net.
;; Received 130 bytes from 204.13.251.16#53(204.13.251.16) in 10 ms

伺服器正在使用的 IP 地址上設置的網路遮罩 ( 64.x.x.x) 是 to 255.0.0.0,這很寬,這意味著對同樣以 IP 地址開頭的任何域的請求64.都沒有正確地路由到伺服器之外。

解決此問題的方法是將本地機器上 IP 地址上使用的網路遮罩降低為 255.255.255.0,這意味著任何開始的地址64.仍將在機器外部解析。

引用自:https://serverfault.com/questions/654165