我在使用 centOS 6.3 64 位时遇到了问题。我想在这里使用 bind 设置我的名称服务器。我列出了我的所有配置
[root@izyon92 ~]# cat/etc/hosts
--------------
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
182.19.26.92 izyon92.zyonize1.com izyon92
[root@izyon92 ~]# cat /etc/sysconfig/network
---------------------------------------------
NETWORKING=yes
HOSTNAME=izyon92.zyonize1.com
GATEWAY=182.19.26.89
[root@izyon92 ~]# cat /etc/resolv.conf
--------------------------------------------
# Generated by NetworkManager
search zyonize1.com
nameserver 182.19.26.92
[root@izyon92 ~]# cat /etc/named.conf
--------------------------------------------
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
#listen-on port 53 { 127.0.0.1; };
listen-on-v6 port 53 { none; };
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 { 182.19.26.92; };
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";
[root@izyon92 ~]# cat /etc/named.rfc1912.zones
--------------------------------------------------
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
// and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (c)2007 R W Franks
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "localhost.localdomain" IN {
type master;
file "named.localhost";
allow-update { none; };
};
zone "localhost" IN {
type master;
file "named.localhost";
allow-update { none; };
};
zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.loopback";
allow-update { none; };
};
zone "1.0.0.127.in-addr.arpa" IN {
type master;
file "named.loopback";
allow-update { none; };
};
zone "0.in-addr.arpa" IN {
type master;
file "named.empty";
allow-update { none; };
};
zone "zyonize1.com" {
type master;
file "/var/named/zyonize.com.hosts";
};
[root@izyon92 ~]# cat /var/named/zyonize.com.hosts
---------------------------------------------------------
$ttl 38400
zyonize1.com. IN SOA 182.19.26.92. dev\.izyon.gmail.com. (
1347436958
10800
3600
604800
38400 )
zyonize1.com. IN NS 182.19.26.92.
zyonize1.com. IN A 182.19.26.92
www.zyonize1.com. IN A 182.19.26.92
izyon92.zyonize1.com. IN A 182.19.26.92
I have disabled selinux and stopped iptables.
dig and nslookup is working fine in the same machine
[root@izyon92 ~]# dig zyonize1.com
----------------------------------------
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6_3.2 <<>> zyonize1.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55751
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;zyonize1.com. IN A
;; ANSWER SECTION:
zyonize1.com. 38400 IN A 182.19.26.92
;; AUTHORITY SECTION:
zyonize1.com. 38400 IN NS 182.19.26.92.
;; Query time: 0 msec
;; SERVER: 182.19.26.92#53(182.19.26.92)
;; WHEN: Fri Sep 14 00:09:19 2012
;; MSG SIZE rcvd: 72
[root@izyon92 ~]# nslookup zyonize1.com
----------------------------------------------
Server: 182.19.26.92
Address: 182.19.26.92#53
Name: zyonize1.com
Address: 182.19.26.92
但是我面临的问题是,我有一台 Windows 机器,为了测试这个 DNS 和名称服务器,我将第一个 IPv4 DNS 服务器设置为 182.19.26.92。以下是详细信息
Connection-specific DNS Suffix:
Description: Realtek PCIe GBE Family Controller
Physical Address: 14-FE-B5-9F-3A-A8
DHCP Enabled: No
IPv4 Address: 192.168.2.50
IPv4 Subnet Mask: 255.255.255.0
IPv4 Default Gateway: 192.168.2.1
IPv4 DNS Servers: 182.19.26.92, 182.19.95.66
IPv4 WINS Server:
NetBIOS over Tcpip Enabled: Yes
Link-local IPv6 Address: fe80::45cc:2ada:c13:ca42%16
IPv6 Default Gateway:
IPv6 DNS Server:
当我从这台机器上获取信息时,它找不到服务器。
而在另一台具有另一个有效 IP 的服务器上,使用 Fedora ping 可以正常工作。
答案1
我有一些疑问,但我还没有足够的代表来发表评论,所以我会将其作为答案提出,并留有后续的空间。
首先,我认为您遇到的是网络问题,而不是 DNS 问题。如果您无法 ping ip(182.19.26.92),则 182.19.26.92 服务器上可能存在网络连接问题。我很想知道输出结果,ifconfig
想知道这是否位于 NAT 后面。查看接口配置文件的输出可能也会有所帮助:for x in /etc/sysconfig/network-scripts/ifcfg-* ; do echo $x: ; cat $x ; done
此外,(可能与您当前的问题无关,但仍然是一个问题)您的区域文件 /var/named/zyonize.com.hosts 在我看来不正确。以下是显示我建议的更改的差异:
--- zonefile.orig 2013-08-22 15:16:08.000000000 -0400
+++ zonefile.new 2013-08-22 15:17:02.000000000 -0400
@@ -1,6 +1,6 @@
$ttl 38400
-zyonize1.com. IN SOA 182.19.26.92. dev\.izyon.gmail.com. (
+zyonize1.com. IN SOA ns1.zyonize1.com dev\.izyon.gmail.com. (
1347436958
@@ -12,7 +12,8 @@
38400 )
-zyonize1.com. IN NS 182.19.26.92.
+zyonize1.com. IN NS ns1.zyonize1.com.
+ns1.zyonize1.com. IN A 182.19.26.92
zyonize1.com. IN A 182.19.26.92
您会注意到 NS 记录应该指向一个名称,并带有相关的粘合记录,而不是直接指向一个 IP。
答案2
named 应该监听所有 IPv4 地址:
listen-on port 53 { any; };
与 :
allow-query { 182.19.26.92; };
您仅允许来自服务器 IP 地址的查询。您可能希望允许来自任何地方的查询:
allow-query { any;};