这是我的文件:/var/named/example.com.zone
$ORIGIN example.com.
$TTL 86400
@ IN SOA dns1.example.com. hostmaster.example.com. (
2001062501 ;serial
21600 ;refresh after 6 hours
3600 ;retry after 1 hour
604800 ;expire after 1 week
86400 ) ;minimum TTL 1 day
IN NS dsn1.example.com.
IN MX 10 mail.example.com
IN A 192.168.0.104
dns IN A 192.168.0.104
machine6 IN A 192.168.0.104
ftp IN A 192.168.0.104
mail IN CNAME machine6
www IN CNAME machine6
这是我的文件:/var/named/example.com.rr.zone
$ORIGIN 0.168.192.in-addr.arpa.
$TTL 86400
@ IN SOA dns1.example.com. hostmaster.example.com. (
2001062501 ;serial
21600 ;refresh after 6 hours
3600 ;retry after 1 hour
604800 ;expire after 1 week
86400 ) ;minimum TTL 1 day
@ IN NS machine6.example.com.
1 IN PTR machine6.example.com.
2 IN PTR machine6.example.com.
3 IN PTR machine6.example.com.
4 IN PTR machine6.example.com.
这是我的文件:/etc/named.conf
zone "example.com" IN {
type master;
file "example.com.zone";
allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "example.com.rr.zone";
allow-update { none; };
};
但是当我发布# service named restart
Stopping named: [ OK ]
Starting named:
Error in named configuration:
zone example.com/IN: NS 'dsn1.example.com' has no address records (A or AAAA)
zone example.com/IN: not loaded due to errors.
_default/example.com/IN: bad zone
example.com.rr.zone:3: SOA record not at top of zone (104.0.168.192.in-addr.arpa)
zone 0.168.192.in-addr.arpa/IN: loading from master file example.com.rr.zone failed: not at top of zone
zone 0.168.192.in-addr.arpa/IN: not loaded due to errors.
_default/0.168.192.in-addr.arpa/IN: not at top of zone
zone mydomain.com/IN: loaded serial 2013042201
zone localhost.localdomain/IN: loaded serial 0
zone localhost/IN: loaded serial 0
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: loaded serial 0
zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0
zone 0.in-addr.arpa/IN: loaded serial 0
[FAILED]
答案1
您的前向区域文件中存在错误,请参见以下行中的错误:
zone example.com/IN: NS 'dsn1.example.com' has no address records (A or AAAA)
您指定您的NS 记录但dns1.example.com.
一个记录是dns.example.com
正确的区域文件示例:
$TTL 86400
@ IN SOA dns1.example.com. hostmaster.example.com. (
2001062501
21600
3600
604800
86400
)
; NS RECORD
@ IN NS dns1
; MX RECORD
@ IN MX 10 mail
; A RECORDS
@ IN A 192.168.0.104
dns1 IN A 192.168.0.104
mail IN A 192.168.0.104
machine6 IN A 192.168.0.104
ftp IN A 192.168.0.104
; CNAME RECORDS
www IN CNAME example.com.
这MX 记录必须指向一个一个记录,不是CNAME 记录。
此示例还将example.com
在第一个中定义为有效域名一个记录。
machine6
也ftp
可以是CNAME 记录。