我有一个dillema关于如何设置一个DNS作为两个或多个域的主服务器的正确方法? 例如,如果我有两个域: first.com和second.com ,以及一个具有公共IP地址的DNS服务器。 我应该如何设置:
first.com的区域文件
$ORIGIN first.com. @ IN SOA ns1.first.com. hostmaster.first.com. ( 2003080800 ; serial number 3h ; refresh = 3 hours 15M ; update retry = 15 minutes 3W12h ; expiry = 3 weeks + 12 hours 2h20M ; minimum = 2 hours + 20 minutes ) IN NS ns1.first. IN NS ns2.first. ns1 IN A 70.0.0.3 # address for example purposes ns2 IN A 70.0.0.4 #
second.com的区域文件:
$ORIGIN second.com. @ IN SOA ns1.second.com. hostmaster.second.com. ( 2003080800 ; serial number 3h ; refresh = 3 hours 15M ; update retry = 15 minutes 3W12h ; expiry = 3 weeks + 12 hours 2h20M ; minimum = 2 hours + 20 minutes ) IN NS ns1.second. IN NS ns2.second. ns1 IN A 70.0.0.3 # address for example purposes ns2 IN A 70.0.0.4 #
并在父区创build4个NSlogging和4个A胶logging:
first IN NS ns1.first.com. IN NS ns2.first.com. second IN NS ns1.second.com. IN NS ns2.second.com. ns1.first IN A 70.0.0.3 ns2.first IN A 70.0.0.4 ns1.second IN A 70.0.0.3 ns2.second IN A 70.0.0.4
或者应该将其configuration为在second.com中定义ns1.first。 作为主名称服务器,以及ns1.first.com的两个NSlogging。 和ns2.first.com。 没有这些logging? 喜欢这个:
$ORIGIN second.com. @ IN SOA ns1.first.com. hostmaster.second.com. ( 2003080800 ; serial number 3h ; refresh = 3 hours 15M ; update retry = 15 minutes 3W12h ; expiry = 3 weeks + 12 hours 2h20M ; minimum = 2 hours + 20 minutes ) IN NS ns1.first. IN NS ns2.first.
在这种情况下,在父区域,我们将定义四个NSlogging和两个A胶logging:
first IN NS ns1.first.com. IN NS ns2.first.com. second IN NS ns1.first.com. IN NS ns2.first.com. ns1.first IN A 70.0.0.3 ns2.first IN A 70.0.0.4
ns2是两个域均configuration为从属服务器的名称服务器,也是公有IP地址。
我的appologies,如果问题是微不足道的,但阅读大量的文字和思考后,我仍然不知道什么是正确的做法。
谢谢
我认为,通常作为一个域名服务器运营商,您可能想要一劳永逸地决定名称服务器的名称,然后将这些名称用于您托pipe的任意数量的区域。
您的名称服务器可以被命名为客户/目的中性,如ns1.hostingcompany.example , ns2.hostingcompany.example , ns3.hostingcompany.example , ns4.hostingcompany.example 。
可以用多个名称引用相同的名称服务器,但是这往往会导致许多域的粘合logging(可能不在您的控制范围之内?),从而使您难以维护自己的环境。
configuration单个DNS服务器时,通常为每个域设置单独的区域,确保为要configuration特定名称服务器的所有域创build正向和反向区域文件。 您使用的configuration将非常特定于您正在使用的DNS服务器,并且从您的文章中不清楚您正在使用的服务器。 在Linux环境中stream行的DNS服务器是bind9。 要用bind9configuration多个域,下面是你应该做的:
/etc/named.conf :
zone "first.com" { type master; file "/etc/named/zones/db.first.com"; }; zone "second.com" { type master; file "/etc/named/zones/db.second.com"; };
在/etc/named/zones/db.first.com :
$ORIGIN first.com. @ IN SOA ns1.first.com. hostmaster.first.com. ( 2003080800 ; serial number 3h ; refresh = 3 hours 15M ; update retry = 15 minutes 3W12h ; expiry = 3 weeks + 12 hours 2h20M ; minimum = 2 hours + 20 minutes ) IN NS ns1.first.com. IN NS ns2.first.com. ns1.first.com. IN A 70.0.0.3 # address for example purposes ns2.first.com. IN A 70.0.0.4 #
并在/etc/named/zones/db.second.com :
$ORIGIN second.com. @ IN SOA ns1.second.com. hostmaster.second.com. ( 2003080800 ; serial number 3h ; refresh = 3 hours 15M ; update retry = 15 minutes 3W12h ; expiry = 3 weeks + 12 hours 2h20M ; minimum = 2 hours + 20 minutes ) IN NS ns1.second.com. IN NS ns2.second.com. ns1.second.com. IN A 70.0.0.3 # address for example purposes ns2.second.com. IN A 70.0.0.4 #
然后你可以configuration70.0.0.4(或ns2 )作为从机,确保allow-transfers和指定masters的ns1地址。
根据我的理解,不需要胶水logging。
这似乎是正确的做法:
第一个区域文件
$ORIGIN first.com. @ IN SOA ns1.first.com. hostmaster.first.com. ( 2003080800 ; serial number 3h ; refresh = 3 hours 15M ; update retry = 15 minutes 3W12h ; expiry = 3 weeks + 12 hours 2h20M ; minimum = 2 hours + 20 minutes ) IN NS ns1.first.com. IN NS ns2.first.com. ns1 IN A 70.0.0.3 # address for example purposes ns2 IN A 70.0.0.4 #
第二个区域文件
$ORIGIN second.com. @ IN SOA ns1.second.com. hostmaster.first.com. ( 2003080800 ; serial number 3h ; refresh = 3 hours 15M ; update retry = 15 minutes 3W12h ; expiry = 3 weeks + 12 hours 2h20M ; minimum = 2 hours + 20 minutes ) IN NS ns1.first.com. IN NS ns2.first.com. ns1.first.com. IN A 70.0.0.3 # example address ns2.first.com. IN A 70.0.0.4 #
父区域文件
first IN NS ns1.first.com. IN NS ns2.first.com. second IN NS ns1.first.com. IN NS ns2.first.com. ns1.first IN A 70.0.0.3 ns2.first IN A 70.0.0.4