host -l mycity.example.com
;; Connection to 10.0.1.12#53(10.0.1.12) for mycity.example.com failed: connection refused.
这是我的 named.conf.options 文件:
acl "trusted" {
10.0.1.0/16;
localhost;
localnets;
};
options {
directory "/var/cache/bind";
recursion yes;
allow-recursion { trusted; };
allow-query { any; }
allow-query-cache { trusted; }
listen-on { 10.0.1.12; };
allow-transfer {trusted; };
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.
forwarders {
10.0.1.1;
8.8.8.8;
8.8.4.4;
};
//========================================================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//========================================================================
dnssec-validation no;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
仅供参考,只有内部服务器可以访问此名称服务器。
我究竟做错了什么?? :(
来自 Bind9 状态的更多信息:
Apr 26 00:37:12 myserver1 named[15933]: client 10.0.1.12#38844
(myserver2.mycity.example.com): bad zone transfer request:
'myserver2.mycity.example.com/IN': non-authoritative zone (NOTAUTH)
答案1
好的,所以答案很简单:使用带有 -l 选项的 host 命令时,您不使用主机名作为参数。您使用完全限定域名,然后它会返回所有主机。一旦我输入以下命令,一切都按预期工作:
host -l mycity.example.com
server1.mycity.example.com
server2.mycity.example.com