3

I'm following this tutorial: http://groups.drupal.org/node/16862 to setup sub-domain on my ubuntu machine. In step III, I use the same db.mydev as the tutorial except the IP:

mydev. 86400 IN SOA mydev. hostmaster.mydev. (
        20091028 ; serial yyyy-mm-dd
        10800; refresh every 15 min
        3600; retry every hour
        3600000; expire after 1 month +
        86400 ); min ttl of 1 day
IN NS mydev. 
IN MX 10 mydev.
IN A 12.85.28.217
*.mydev. IN A 12.85.28.217

However, when I use named-checkzone mydev db.mydev to check the syntax, I get the error message: zone mydev/IN: has no NS records. Any hints?

clwen
  • 135
  • 1
  • 1
  • 7
  • This one is very helpful post. keep on doing a good work guys i also recommend using the combination of these 2 guides: [How To Configure BIND as a private-network-dns-server-on-ubuntu](https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-ubuntu-14-04) [Troubleshooting BIND dns on Ubuntu](https://help.ubuntu.com/10.04/serverguide/dns-troubleshooting.html) –  Feb 24 '15 at 21:54

2 Answers2

9

You need at least one character of whitespace or a tab (credit: @mdpc's edit for the tab reminder) at the start of every line that begins with the "IN". Some administrators are not partial to tabs: in such cases you should try to keep all of these entries aligned with equal whitespace where possible to do so.

This is because you are technically leaving out the first field of the records that you're defining. It's a shortcut for not having to put "mydev." or "@" at the start of every one of those lines, but it only works if you begin the line with with something that isn't record data.

Andrew B
  • 31,858
  • 12
  • 90
  • 128
5

I agree with Andrew B, except that for readability purposes I would not recommend using only whitespace there. Use the @ symbol or the fully qualified name of the zone ("mydev.") in that spot to make things significantly more readable. Disk space is no longer expensive and saving a few characters at the expense of having a file where you don't understand what the zone parser is doing is not a win.

To explain a little further, each resource record declaration consists of a label, a ttl, a class, a type, and a value. But you can leave out any of those except the value and they will be inherited from above.

The snippet you have posted is trying to declare records with name "mydev." for records of class IN and type SOA, NS, MX, and A, but because you've left out important whitespace at the beginning of the lines for the NS, MX, and A record declarations you're running into problems.

If the items surrounded in square brackets are inherited defaults, instead of:

[mydev.]   IN    NS         mydev.
[mydev.]   IN    MX   10    mydev.
[mydev.]   IN    A          12.85.28.217

you are inadvertently declaring:

IN.[mydev.]   [IN]   NS         mydev.
IN.[mydev.]   [IN]   MX   10    mydev.
IN.[mydev.]   [IN]   A          12.85.28.217

and as a result no NS record is ever declared for plain old:

mydev.   IN   NS   mydev.

resulting in the error message you are seeing, "zone mydev/IN: has no NS records"

Michael McNally
  • 1,450
  • 9
  • 14
  • This is one of those things you can search for for days and weeks! Thanks for clearing this up! 10 years back this wasn't and issue if i remember well. – Digital Human Nov 15 '14 at 08:27