I have a dillema about what would be the proper way to setup one DNS as master server for two or more domains? For example, if I have two domains: first.com and second.com, and one DNS server with public IP address.
Should I setup in this manner:
zone file for 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 #
zone file for 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 #
and in the parent zone create four NS records and four glue A records:
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
Or should it be configured so that in second.com we define ns1.first. as master name server, and two NS records for ns1.first.com. and ns2.first.com. without A records for those? Like this:
$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.
In that case, in parent zone we would define four NS records and two A glue records:
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 is the name server configured as slave server for both domains, also with public IP address.
My appologies if question is trivial, but after reading substantial amount of text and thinking about it I'm still not sure about what is correct way of doing this.
Thanks
Best Answer
I think that typically as a nameserver operator you would want to decide once and for all what the names of your nameservers are and then use those names for any number of zones that you host.
Your nameservers could be named something customer/purpose neutral like
ns1.hostingcompany.example
,ns2.hostingcompany.example
,ns3.hostingcompany.example
,ns4.hostingcompany.example
.It is possible to refer to the same nameservers by multiple names, but that will tend to result in glue records for many domains (maybe outside of your control?), effectively making it harder for you to maintain your own environment.