我有类似这样的域名区域文件maindomain.com
$TTL 14400
maindomain.com. IN SOA ns1.maindomain.com. [email protected]. (
2013120716 ; serial
14400 ; refresh
3600 ; retry
1209600 ; expire
7200 ; negative cache
) ;
; name servers
@ IN NS ns1.maindomain.com.
@ IN NS ns2.maindomain.com.
; mail
; maindomain.com. IN MX 10 mail.maindomain.com.
; name servers
maindomain.com. IN A 4.2.2.1
ns1 IN A 4.2.2.1
ns2 IN A 4.2.2.2
; cname
www IN CNAME maindomain.com.
但我需要将其他域名(如anotherdomain.com
)绑定exampledomain.net
到此服务器。我将这些域名的 DNS 设置为ns1.maindomain.com
和ns2.maindomain.com
。因此,我必须为其他域名创建区域文件。例如:
$TTL 14400
anotherdomain.com. IN SOA ns1.maindomain.com. [email protected]. (
2013120716 ; serial
14400 ; refresh
3600 ; retry
1209600 ; expire
7200 ; negative cache
) ;
; cname
www IN CNAME anotherdomain.com.
我不需要名称服务器anotherdoamin.com
...
zone "maindomain.com" {
type master;
file "/etc/bind/zones/master/maindomain.com.db";
};
zone "anotherdomain.com" {
type master;
file "/etc/bind/zones/master/anotherdomain.com.db";
};
另外,我在区域文件中遇到一个错误:
named-checkzone anotherdomain.com /etc/bind/zones/master/anotherdomain.com.db
zone anotherdomain.com/IN: has no NS records
zone anotherdomain.com/IN: not loaded due to errors.
答案1
每个区域文件一个域。只需编辑您的 named.conf 文件即可为每个区域使用不同的文件。
zone "anotherdomain.com" { type master; file "anotherdomain.DB"; };