1

I'm running bind9 on Debian 8 x64 and want to host two zones for my web site:

example.com
example.net

I configured the named.conf.* files, set up the db.example.com and db.example.net in the zones directory, then tried to load both. The .com succeeded but the .net failed. It said there were no NS records.

I'm using the following NS records for both with the same IP's. Is this not possible?

ns1.example.com IN NS 1.1.1.1
ns2.example.com IN NS 1.1.1.2
0

What you are trying to do is, in principle, quite doable, but I see 4 problems with your zone file snippet. If you post the full zone file I can provide better guidance, but your zone file is totally wrong. A valid zone file (to do what you are trying to do) might look like:

@   IN SOA   ns1.example.com. soa.example.com. (
                        2016010401 ; serial
                        3600; refresh
                        600;  retry
                        86400 ; expire
                        3600 ) ; min TTL

     IN  NS ns1
     IN  NS ns2
     IN  A  33.33.33.33

ns1  IN A   1.1.1.1
ns2  IN A   2.2.2.2
www  IN CNAME www.provider.domain.

There are a few important bits here -
Note the "@" as the first character in the zone file - that means that this domain name takes its queue as to what domain name we are referring to from the reference in /etc/named.conf - this allows us to use the identical domain structure for oth domains.

The IN NS nsX records don't have anything at the front - thats because we are setting the NS records for the entire zone. The "nsX" bit is relative addressing - ie equivalnet to ns1.@ = ns1.example.com or ns1.example.net depending on the entry in named.conf

The lines ns1 in A 1.1.1.1 specify the IP address for ns1. This does create a circular reference - ie in order to resolve ns1.example.com you need to know the ip address for the nameserver example.com, which needs to know ns1.example.com. Bind can figure this out for itself - but the rest of the Internet can't - for this reason you need to specify IP addresses and domains with the registrar when registering the domain [so a "Glue" record can be created in the root/parent nameservers]

Note tht if you specify something like smtp.example.com IN A 20.20.20.20 this will not work as expected. THe correct way to do this is "smtp.example.com. IN A 20.20.20.20" (note the ." character - if you leave it out, Bind will interpret you to mean smtp.example.com.example.com

For the sake of completeness, you do, of-course, need to specify the zone file in /etc/named.conf or equivalent. You do this as follows:

zone "example.com"
{
     type master;
     file "/path/to/zone.file";
};


zone "example.net"
{
     type master;
     file "/path/to/zone.file";
};
  • This would make domain 1 have name servers ns1.example.com and ns2.example.com and domain 2 have ns1.example.net and ns2.example.net. Is it not possible for domain 2 to also use the same name servers as domain 1? – user72718271 Jan 3 '16 at 22:11
  • Similar to how you can use your domain registrars dns servers for your zone info. – user72718271 Jan 3 '16 at 22:12
  • Yes, if you want ns1.example.com for both nameservers set the ns records to ”in ns ns1.example.com.” – davidgo Jan 4 '16 at 10:49
  • Records with omitted names aren't necessarily for the zone origin; they're for whatever name was previously specified. – Blacklight Shining Feb 5 '16 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.