故意出错,你可以知道一些错误发生的原因,检查方法:

tail -n 20 /var/log/messages | grep named


下面是碰到的部分错误:

1 logging channel 'query_log' file '/logs/query.log': file not found

开了logging,但没有创建日志文件会提示出错

2 logging channel 'query_log' file '/logs/query.log': permission denied

可能伴有这样的错误:
kernel: audit(1240046511.743:4): avc:  denied  { write } for  pid=5649 comm="named" name="logs" dev=dm-0 ino=778352 scontext=root:system_r:named_t:s0 tcontext=root:object_r:named_conf_t:s0 tclass=dir

有权限的问题,可能你得查一下用户权限,如果是使用SELINUX,输入getenforce 看看现在的安全级别
可以关闭SELinux如果你不需要,编辑 /etc/sysconfig/selinux 文件

3 couldn't open pid file '/var/named.pid': Permission denied

还是目录权限的问题,如果没有该目录,创建并且给named权限

4 /etc/named.conf:14: when using 'view' statements, all zones must be in views

如果使用了view,那就不能在主文件单独定义了啦,可怜的,必须在每个view里面都定义每个zone
但是,如果你不需要根据每个view处理不一样的,你可以在每个view都引用同一个解析文件

5 transfer of 'aslibra.com/IN' from 192.168.1.41#53: failed while receiving responses: permission denied

检查一下是否master加了此主机为允许的ip了
Master在reload和restart时会发生notify

... zone myzcom.com/IN/any: loaded serial 2008061100
... running
... zone aslibra.com/IN/any: sending notifies (serial 2008061100)


也就是加载后会发送当前的serial标识的给notify列表的机器
slave机器要注意对配置文件的可写权限

引用
..  received notify for zone 'aslibra.com'
..  dumping master file: config/tmp-XXXXeybkW9: open: permission denied
..  transfer of 'aslibra.com/IN' from 192.168.1.41#53: failed while receiving responses: permission denied
..  transfer of 'aslibra.com/IN' from 192.168.1.41#53: end of transfer


正常的情况:

引用
..  received notify for zone 'aslibra.com'
..  zone aslibra.com/IN: transferred serial 2008061100
..  transfer of 'aslibra.com/IN' from 192.168.1.41#53: end of transfer


两个机器的配置文件会不一样的,传输并非文件传输,而是数据传输:

Master的配置文件:

[root@aslibra etc]# cat config/domain-aslibra.com.any
$TTL 300
@       IN      SOA     ns.aslibra.com. hqlulu.gmail.com. (
                                2008061100 ; serial
                                3600       ; refresh
                                60         ; retry
                                604800     ; expire
                                3600       ; minimum
                                )

                                NS      ns2.aslibra.com.
                                NS      ns.aslibra.com.


www                             A       222.76.215.25
ns                              A       192.168.1.41
ns2                             A       192.168.1.42


Slave的配置文件:

[root@localhost etc]# cat config/domain-aslibra.com.any
$ORIGIN .
$TTL 300        ; 5 minutes
aslibra.com             IN SOA  ns.aslibra.com. hqlulu.gmail.com. (
                                2008061100 ; serial
                                3600       ; refresh (1 hour)
                                60         ; retry (1 minute)
                                604800     ; expire (1 week)
                                3600       ; minimum (1 hour)
                                )
                        NS      ns.aslibra.com.
                        NS      ns2.aslibra.com.
$ORIGIN aslibra.com.
ns                      A       192.168.1.41
ns2                     A       192.168.1.42
www                     A       222.76.215.25


6 如何检查配置文件

[root@aslibra etc]# named-checkconf -t /var/named/chroot/
/etc/config/view-any.conf:13: option 'masters' is not allowed in 'master' zone 'aslibra.com'
[root@aslibra etc]# named-checkconf -t /var/named/chroot/
[root@aslibra etc]#


如果有错误,会提示你信息,没有错则没有提示了

7 如何检查zone文件

[root@fetion etc]# named-checkzone -t /var/named/chroot/ aslibra.com /etc/config/domain-aslibra.com.any
zone aslibra.com/IN: loaded serial 2008061100
OK
[root@fetion etc]# named-checkzone aslibra.com /var/named/chroot/etc/config/domain-aslibra.com.any
zone aslibra.com/IN: loaded serial 2008061100
OK


8 重载配置文件

service named reload



原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
Tags: ,
发表评论
AD
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML 打开UBB 打开表情 隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 不区分大小写
 

阅读推荐

服务器相关推荐

开发相关推荐

应用软件推荐