I'm new to the DNS world. I followed this tutorial to config an Authoritative-Only DNS Server. However, the tutorial is only about one domain name and I'm confused on how to add the second domain name. There are also questions in the comments of the tutorial asking about the same question, but there is no answer to them and I couldn't find any other tutorial or questions (like this one) on how to config two domains.
To summarize, we have two web servers example1.com and example2.com for which we would like to use one bind server as our customized DNS. According to the tutorial, we create a zone file for example1.com as follows:
$TTL 604800
@ IN SOA ns1.example1.com. admin.example1.com. (
5 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
; Name servers
example1.com. IN NS ns1.example1.com.
example1.com. IN NS ns2.example1.com.
; A records for name servers
ns1 IN A 192.0.2.1
ns2 IN A 192.0.2.2
; Other A records
@ IN A 192.0.2.3
www IN A 192.0.2.3
and then we create two NS records(ns1.example1.com and ns2.example1.com) and a glue record on our hosting provider's nameserver. Now how can I add example2.com and use the same bind server to resolve it? I created a zone file and added two new ns records like this:
$TTL 604800
@ IN SOA ns1.example2.com. admin.example2.com. (
5 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
; Name servers
example2.com. IN NS ns1.example2.com.
example2.com. IN NS ns2.example2.com.
; A records for name servers
ns1 IN A 192.0.2.1
ns2 IN A 192.0.2.2
; Other A records
@ IN A 192.0.2.4
www IN A 192.0.2.5
and then added NS records and glue records for n1.example2.com and ns2.example2.com on my hosting provider's name server, so we will have two different nameservers ns1.example1.com and ns2.example2.com for these two different domain names but they both point to the same IP (our configured bind server). Is it a good practice to do that? How can we config it to have just one name server for both?