当前位置: 技术问答>linux和unix
DNS 配置是哪里出错了?
来源: 互联网 发布时间:2016-06-06
本文导语: 在网上找了好多关于DNS 配置文档,,找了几个都没配置成功,,,我把我的配置文档都贴上来,,大家帮我看看是哪里出错了.... 系统: RHEL5.0 IP 1.1.1.10 [root@localhost etc]# rpm -qa bind* caching-* bind-libs-9.3.3-7.el5 bind-9.3.3-7...
在网上找了好多关于DNS 配置文档,,找了几个都没配置成功,,,我把我的配置文档都贴上来,,大家帮我看看是哪里出错了....
系统: RHEL5.0 IP 1.1.1.10
[root@localhost etc]# rpm -qa bind* caching-*
bind-libs-9.3.3-7.el5
bind-9.3.3-7.el5
bind-devel-9.3.3-7.el5
bind-utils-9.3.3-7.el5
caching-nameserver-9.3.3-7.el5
bind-chroot-9.3.3-7.el5
bind-sdb-9.3.3-7.el5
在/etc/ 和 /var/named/chroot/etc/ 都有 named.caching-nameserver.conf 与named.rfc1912.zones 这二个文件:内容一样.
[root@localhost etc]# vi /etc/named.caching-nameserver.conf
options {
listen-on port 53 { 1.1.1.10; };
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";
query-source port 53;
query-source-v6 port 53;
allow-query { any; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { localhost; };
match-destinations { localhost; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
[root@localhost etc]# vi 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
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "." IN {
type hint;
file "named.ca";
};
zone "localdomain" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
zone "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.ip6.local";
allow-update { none; };
};
zone "255.in-addr.arpa" IN {
type master;
file "named.broadcast";
allow-update { none; };
};
zone "0.in-addr.arpa" IN {
type master;
file "named.zero";
allow-update { none; };
};
zone "hello521.com" IN {
type master;
file "hello521.com.zone";
allow-update { none; };
};
zone "1.1.1.in-addr.arpa" IN {
type master;
file "1.1.1.zone";
allow-update { none; };
};
在/var/named 和 /var/named/chroot/var/named/ hello521.com.zone 和 1.1.1.zone都有这二个文件,内容一样..
[root@localhost var]# cd named
[root@localhost named]# vi hello521.com.zone
$TTL 1D
$TTL 1D
@ 1D IN SOA hello521.com. root.hello521.com. (
42 serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS www.hello521.com.
IN MX 10 mail.hello521.com.
www IN A 1.1.1.10
mail IN A 1.1.1.10
ftp IN A 1.1.1.10
[root@localhost named]# vi 1.1.1.zone
$TTL 1D
@ IN SOA hello521.com. root.hello521.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS www.hello521.com.
11 IN PTR www.hello521.com.
12 IN PTR ftp.hello521.com.
10 IN PTR mail.hello521.com.
测试::::
[root@localhost etc]# cat resolv.conf
nameserver 1.1.1.10
[root@localhost named]# service named restart
停止 named: [确定]
启动 named: [确定]
[root@localhost named]# host localhost
Host localhost not found: 2(SERVFAIL)
[root@localhost named]# rndc status
number of zones: 0
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/1000
tcp clients: 0/100
server is up and running
[root@localhost named]# nslookup www.hello520.com
Server: 1.1.1.10
Address: 1.1.1.10#53
** server can't find www.hello520.com: SERVFAIL
结束,请大家帮忙看下::
系统: RHEL5.0 IP 1.1.1.10
[root@localhost etc]# rpm -qa bind* caching-*
bind-libs-9.3.3-7.el5
bind-9.3.3-7.el5
bind-devel-9.3.3-7.el5
bind-utils-9.3.3-7.el5
caching-nameserver-9.3.3-7.el5
bind-chroot-9.3.3-7.el5
bind-sdb-9.3.3-7.el5
在/etc/ 和 /var/named/chroot/etc/ 都有 named.caching-nameserver.conf 与named.rfc1912.zones 这二个文件:内容一样.
[root@localhost etc]# vi /etc/named.caching-nameserver.conf
options {
listen-on port 53 { 1.1.1.10; };
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";
query-source port 53;
query-source-v6 port 53;
allow-query { any; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { localhost; };
match-destinations { localhost; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
[root@localhost etc]# vi 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
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "." IN {
type hint;
file "named.ca";
};
zone "localdomain" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
zone "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.ip6.local";
allow-update { none; };
};
zone "255.in-addr.arpa" IN {
type master;
file "named.broadcast";
allow-update { none; };
};
zone "0.in-addr.arpa" IN {
type master;
file "named.zero";
allow-update { none; };
};
zone "hello521.com" IN {
type master;
file "hello521.com.zone";
allow-update { none; };
};
zone "1.1.1.in-addr.arpa" IN {
type master;
file "1.1.1.zone";
allow-update { none; };
};
在/var/named 和 /var/named/chroot/var/named/ hello521.com.zone 和 1.1.1.zone都有这二个文件,内容一样..
[root@localhost var]# cd named
[root@localhost named]# vi hello521.com.zone
$TTL 1D
$TTL 1D
@ 1D IN SOA hello521.com. root.hello521.com. (
42 serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS www.hello521.com.
IN MX 10 mail.hello521.com.
www IN A 1.1.1.10
mail IN A 1.1.1.10
ftp IN A 1.1.1.10
[root@localhost named]# vi 1.1.1.zone
$TTL 1D
@ IN SOA hello521.com. root.hello521.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS www.hello521.com.
11 IN PTR www.hello521.com.
12 IN PTR ftp.hello521.com.
10 IN PTR mail.hello521.com.
测试::::
[root@localhost etc]# cat resolv.conf
nameserver 1.1.1.10
[root@localhost named]# service named restart
停止 named: [确定]
启动 named: [确定]
[root@localhost named]# host localhost
Host localhost not found: 2(SERVFAIL)
[root@localhost named]# rndc status
number of zones: 0
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/1000
tcp clients: 0/100
server is up and running
[root@localhost named]# nslookup www.hello520.com
Server: 1.1.1.10
Address: 1.1.1.10#53
** server can't find www.hello520.com: SERVFAIL
结束,请大家帮忙看下::
|
你用named -g看下具体的问题,有提示的
|
看一下是不是你的/etc/hosts的影响
|
帅哥看日志,服务出问题日志里写的很清楚,tail /var/log/messages
|
这个,我不知道,我只知道我做的时候需要用到named.conf你可以查查相关资料
|
很明确的告诉你了,没有找到/etc/named.conf文件