Linux Bind DNS服务器软件 not found:2(Servfail) 错误

在Redhat9下使用Bind进行配置,启动服务,通过host获取解析结果时,一直出现host xxx not found:2(Servfail)的错误,到处找解决方法无果。。。 
 

不停的搞,总算好了。写下过程,仅供参考!

先查看日志文件tail -n 20 /var/log/messages,得到的结果:

Nov  7 01:05:07 localhost named[7850]: running
Nov  7 01:05:08 localhost named[7850]: zone our.com/IN: sending notifies (serial 2011110400)
Nov  7 01:05:37 localhost named: named reload failed
Nov  7 01:05:37 localhost named[7850]: shutting down
Nov  7 01:05:37 localhost named[7850]: no longer listening on 127.0.0.1#53
Nov  7 01:05:37 localhost named[7850]: no longer listening on 192.168.29.100#53
Nov  7 01:05:37 localhost named[7850]: exiting
Nov  7 01:05:37 localhost named: named shutdown succeeded
Nov  7 01:05:39 localhost named[7937]: starting BIND 9.2.1 -u named
Nov  7 01:05:39 localhost named[7937]: using 1 CPU
Nov  7 01:05:39 localhost named[7937]: loading configuration from '/etc/named.conf'
Nov  7 01:05:39 localhost named: named startup succeeded
Nov  7 01:05:39 localhost named[7937]: no IPv6 interfaces found
Nov  7 01:05:39 localhost named[7937]: listening on IPv4 interface lo, 127.0.0.1#53
Nov  7 01:05:39 localhost named[7937]: listening on IPv4 interface eth0, 192.168.29.100#53
Nov  7 01:05:39 localhost named[7937]: zone 0.0.127.in-addr.arpa/IN: loaded serial 9
Nov  7 01:05:39 localhost named[7937]: zone our.com/IN: loaded serial 2011110400Nov  7 01:05:39 localhost named[7937]: zone localhost/IN: loaded serial 1
Nov  7 01:05:39 localhost named[7937]: running
Nov  7 01:05:39 localhost named[7937]: zone our.com/IN: sending notifies (serial 2011110400)

看日志没能看出什么不对劲。

后来从其可以正常服务的机子上找了相关配置文件进行对比,竟然是配置的语法错误!汗。。。。

named.conf正确的应该是这样的:

options { //全局选项
        directory "/var/named";	//设置Bind工作目录
};
controls { //运行本地主机存取,运行远程控制
        //inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
include "/etc/rndc.key";
zone  "." { //设置根域
	type hint;
	file  "named.ca";	//数据库文件为"named.ca"
};
zone  "0.0.127.in-addr.arpa" { //本地IP的逆向解析
	type master; 
	file  "0.0.127.in-addr.arpa.zone"; 
};
zone  "localhost" { //localhost域名解析
	type master; 
	file  "localhost.zone"; 
};
/*
zone  "29.168.192.in-addr.arpa" { //192.168.29.xIP逆向解析
	type master; 
	file  "29.168.192.in-addr.arpa.zone"; 
};
*/
zone  "our.com" { //our.com域名解析
	type master; 
	file  "our.com.zone"; 
};

解析文件是这样的:

$TTL 86400 ;						#TTL1天
@	IN	SOA	@  our.com (
			2011110400 ;	#区域版本号
			5H ; 				#辅助域名服务器更新时间间隔
			10M ; 			#再尝试时间间隔
			5D ; 				#辅助域名服务器更新超时时间
			1D ;		 		#资源生存周期1天
			)


	IN	NS	127.0.0.1

dns	IN	A	192.168.29.100 ;	#DNS服务器域名解析
www	IN	A	192.168.29.101 ;	#web服务器域名解析
ftp	IN	A	192.168.29.102 ;	#ftp服务器域名解析
web	IN	CNAME	www ;					#www的别名web

特别的注意的是行尾应有分号,而且分号之前应该有一个空格,我就死在这了,一个晚上啊。。。。

天啊。。。。

睡觉,晚安,珍爱生命,远离代码!!!

你可能感兴趣的:(linux,redhat,File,服务器,interface,DNS服务器)