Nov 16 15:01:49 rh71 named[2287]: loading configuration from '/etc/named.conf'
Nov 16 15:01:49 rh71 named[2287]: /etc/named.conf:41: parse error near zone
Nov 16 15:01:49 rh71 named[2287]: loading configuration: failure
Nov 16 15:01:49 rh71 named[2287]: exiting (due to fatal error)
这个错误信息明显指出了是 /etc/named.conf 的问题,而且很可能在 41 行附近。根据我个人的经验,这通常是您漏了 “ ;”符号的原因而已。
如果您碰到如下信息,那是没有为所有 RR 记录项设定 TTL 而已,您可以为每一个记录项补上 TTL (在 IN 前面),也可以在记录文件的前面用 $TTL 来设定:
Nov 16 15:04:47 rh71 named[2395]: master.c:1172: unexpected error:
Nov 16 15:04:47 rh71 named[2395]: dns_master_load: siyongc:3: no TTL specified.
THIS ZONE WILL NO LONGER WORK IN FUTURE VERSIONS. Add a TTL.
Nov 16 15:04:47 rh71 named[2395]: dns_master_load: siyongc:5: using
RFC 1035 TTL semantics
如果您碰到下面这样的信息,那多是因为您打字错误的关系,输入了 named 不认识的记录类别名称(例如漏了记录名称或打错了):
Nov 16 15:07:44 rh71 named[2422]: dns_master_load: siyongc:2: unknown RR
type 'siyongc.domain.'
Nov 16 15:07:44 rh71 named[2422]: dns_zone_load: zone siyongc.domain/IN: loading
master file siyongc: unknown class/type
如下的问题,那可能是您没有定义 SOA 记录,或设定有错误:
Nov 16 15:14:33 rh71 named[2506]: dns_zone_load: zone siyongc.domain/IN: could
not find NS and/or SOA records
Nov 16 15:14:33 rh71 named[2506]: dns_zone_load: zone siyongc.domain/IN: has
0 SOA records
Nov 16 15:14:33 rh71 named[2506]: dns_zone_load: zone siyongc.domain/IN: no
NS records
下面的问题可能是您的 SOA 记录中多输入了一组数字,或少输入了一组数字,或数字格式有错误:
Nov 16 15:14:33 rh71 named[2506]: dns_zone_load: zone siyongc.domain/IN: could not
find NS and/or SOA records
Nov 16 15:14:33 rh71 named[2506]: dns_zone_load: zone siyongc.domain/IN: has
0 SOA records
Nov 16 15:14:33 rh71 named[2506]: dns_zone_load: zone siyongc.domain/IN: no
NS records
Nov 16 15:18:24 rh71 named[2562]: dns_rdata_fromtext: siyongc:4: near eol: unexpected
end of input
Nov 16 15:18:24 rh71 named[2562]: dns_zone_load: zone siyongc.domain/IN: loading
master file siyongc: unexpected end of input
Nov 16 15:19:34 rh71 named[2640]: dns_rdata_fromtext:
siyongc:4: near '14B400':
syntax error
Nov 16 15:19:34 rh71 named[2640]: dns_zone_load: zone
siyongc.domain/IN: loading
master file siyongc: syntax error
以下问题可能是 SOA 的 “ ( ) ”符号有问题,要么是“ ( ” 给断到下一行了,要么是“ ) ”给批注掉了:
Nov 16 15:22:08 rh71 named[2669]: dns_rdata_fromtext: siyongc:3: near eol: unexpected
end of input
Nov 16 15:22:08 rh71 named[2669]: dns_zone_load: zone siyongc.domain/IN: loading
master file siyongc: unexpected end of input
Nov 16 15:22:52 rh71 named[2696]: dns_rdata_fromtext: siyongc:4:
near 'IN': extra input text
Nov 16 15:22:52 rh71 named[2696]: dns_zone_load: zone siyongc.domain/IN:
loading master file siyongc: extra input text
以下是您没有设定 NS 记录或 NS 记录设定有错误:
Nov 16 15:25:30 rh71 named[2801]: dns_zone_load: zone siyongc.domain/IN: no NS records
下面的错误可能是您设定了一个记录项超出了当前 ORIGIN 的范围,例如 localhost. 或 siyongc. (也就是错误使用 FQDN );或是错误的使用了 $ORIGIN 设定;或是在 named.conf 中有多个 zone 在分享同一份记录文件:
Nov 16 15:31:20 rh71 named[2920]: dns_master_load: siyongc:16:
ignoring out-of-zone data
下面的错误,有可能您在设定多个 $ORIGIN 并同时尝试设定多个 SOA 时出现的错误:
Nov 16 15:28:31 rh71 named[2855]: dns_master_load: siyongc:26:
not at top of zone
许多许多问题,事实上您都可以在 /var/log/messages 中找到,当您发现这些错误信息之后,看看是关于什么记录的,然后顺藤摸瓜,留心一下档案内容,就比较容易找到错误的原因了。
有时候,您想简化您的 DNS 设定工作,您可以使用 netconf 来做。不过,根据我的经验是:netconf 未必能够完全帮您正确的设定起来。当您重新启动 named 之后,别忘了看一下 /var/log/messages ,确定没有错误发生。如果您使用工具来设定 DNS 而碰到问题,这就需要您有手工设定的能力了。