我在CentOS 6服务器上安装了bind
,用于配置DNS区域以定义域。我的/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 { any; };
recursion no;
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";
zone "xxxxxx.yyy" IN {
type master;
file "xxxxxx.yyy.zone";
allow-update {none;};
};
以及基于TLDP的我的区域配置文件(/var/named/xxxxxx.yyy.zone
)是:
$TTL 86400
@ IN SOA ns1.xxxxxx.yyy. root.xxxxxx.yyy. (
2014011001 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
@ IN NS ns1.xxxxxx.yyy.
@ IN NS ns2.xxxxxx.yyy.
ns1 IN A aaa.bbb.cc.ddd
ns2 IN A aaa.bbb.cc.ddd
我将域的名称服务器设置为ns1.xxxxxx.yyy
和ns2.xxxxxx.yyy
,我可以在whois上获取此名称服务器:
meysam@freedom:~$ whois xxxxxx.yyy
// blah blah blah
% Information related to 'xxxxxx.yyy'
domain: xxxxxx.yyy
ascii: xxxxxx.yyy
// blah blah blah
nserver: ns1.xxxxxx.yyy
nserver: ns2.xxxxxx.yyy
但是当我ping域时,它会返回未知主机错误:
meysam@freedom:~$ ping xxxxxx.yyy
ping: unknown host xxxxxx.yyy
nslookup
的输出也类似:
meysam@freedom:~$ nslookup xxxxxx.yyy
Server: 127.0.1.1
Address: 127.0.1.1#53
Non-authoritative answer:
*** Can't find yyyyyy.xxx: No answer
有关更多信息,请附加dig
命令的输出:
meysam@freedom:~$ dig xxxxxx.yyy
; <<>> DiG 9.9.5-3ubuntu0.5-Ubuntu <<>> xxxxxx.yyy
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57346
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;xxxxxx.yyy. IN A
;; AUTHORITY SECTION:
xxxxxx.yyy. 6606 IN SOA ns1.xxxxxx.yyy. root.xxxxxx.yyy. 2014011001 3600 1800 604800 86400
;; Query time: 123 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Fri Dec 25 20:57:36 IRST 2015
;; MSG SIZE rcvd: 87
有什么问题?我该如何解决这个错误?
欢迎任何指南。 感谢。
答案 0 :(得分:1)
如果没有为域的根目录定义,则表示您正在查询A记录。
尝试在区域文件中添加一个。
Swifty
答案 1 :(得分:0)
首先,尝试检查您的地址是否以这种方式解析。 ns.awsdns.net
是您的名称服务器
nslookup mydomain.com ns.awsdns.net
如果域喜欢这种方式,请按照以下步骤操作:
sudo mv /etc/resolv.conf /etc/resolv.conf_orig
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo vim /etc/resolv.conf
编辑此行并将其放入resolv.conf中并退出(8.8.8.8是google DNS)
nameserver 8.8.8.8
最后,重新启动网络服务
sudo service networking restart