Mac OS X Server: Remove an errant Zone from DNS.

Since moving, I’ve had to re-think my entire strategy for getting my Xbox online. I have a decent (but currently broken) 26″ Monitor that can display 1080p. While attempting to hook my Xbox up via my iMac’s ethernet port I ran into an issue. This was specifically related to DNS. I had a couple of out-dated DNS Servers that I wanted to change… but I ran into this ‘lovely’ error message.

4129024501 e98e7b50c7 o Mac OS X Server: Remove an errant Zone from DNS.

Now the Error message states what the issue is currently, so I flipped back to Zones and saw a zone for an IP that was removed already. So I tried to remove the incorrect Zone. To my surprise I saw the Zone re-appear.

Since my initial process for fixing did not pan out, I decided to try and add a name server..

4129024521 c5abd1c399 Mac OS X Server: Remove an errant Zone from DNS.

To my utter annoyance the name server ‘magically’ disappeared. I did some googling and came across a thread on the Apple discussion boards that points to editing the actual DNS files. Being the adventurous type I decided to locate the files and look at what could be the issue. The base path for all DNS on an OS X Server is /etc/dns

Within this directory I saw three files, first of which was loggingOptions.conf.apple. As the name explains this is the file used for determining where the logging redirects. So this was not the file I was looking for.
The second file is options.conf.apple. This file is used to determine whether zone-transfers are allowed and which forwarders are used for DNS. This wasn’t the file either. The last file named ‘publicView.conf.apple’ was the file I was looking for.

In this file I found the following zone description:

4129024549 153c988863 o Mac OS X Server: Remove an errant Zone from DNS.

In order to delete this zone you have to go into terminal, navigate to /etc/dns and type ‘sudo cp publicView.conf.apple publicView.conf.apple.backup’. You will be prompted for your password. This command will create a backup of your current DNS settings, should something go horribly wrong. I cannot stress enough that you SHOULD make a backup before doing anything major via the command line.

Next type in ‘sudo vi publicView.conf.apple’. This may ask for your password again. Once you have loaded the editor, use the arrows keys to navigate to which zone you want to delete. Next hit the ‘d’ key twice to delete each line for the zone that you want to delete. Once you have deleted all of the lines for that zone hit the ‘:’ key and type in ‘w’ and hit enter. Next, type in ‘q’ and hit enter. (all of the commands are without the single quotes).

The final step is to restart DNS and verify that the rogue zone is now gone. If something has gone horribly wrong do not fret you have your backup. To copy the old DNS file to the current one, go to terminal, navigate to /etc/dns.

Type in ‘sudo cp publicView.conf.apple.backup publicView.conf.apple’. This will copy your backup copy to the current working copy. Restart DNS and verify that everything is back to the original setup. If all is, retry to edit and remove the zone.

Once I did this all is now back to normal and I can edit my DNS forwarders. If you’re having a specific issue, or know of one that is affecting a lot of users, let me know at wdixon at macgasm dot net or leave a comment.

  • SmooveP

    Mate,
    Just had the exact same problem, and now I can’t add any zones. you press save and they vanish. I have to say OSX Server is a crock of shite. I’m using RHEL for my netsevices and just want to setop OpenDirectory – hence need to have a local DNS server. Crap.

  • Sector-mac

    Thanks for this. I was banging my head against the wall over this and this fixed it for me.

    G

  • http://www.treefish.co.nz David Apimerika

    Works for me.

    As for SmooveP’s comment. It’s horses for courses. If you want to tinker with your own rolled DNS config, then fine, use Linux. If you’re an Admin that just wants a simple DNS to work, then the Mac OS X server Server Admin approach is fine.

    What’s pretty cool is that once you have a basic setup in place using the GUI tool, you can then go in and modify the files themselves to suit. And hey – it’s named! How’s that for familiarity to a UNIX/Linux admin.

  • jlorre

    i had a similar problem with unexpectedly disapperaing and reappearing of zones and their content. This trouble started after I had pasted information in software Info field of a machine record.
    It seems to me that carriage returns are refused in this field when TYPING, but the carriage returns are not intercepted when you PASTE them in the field.
    Result of a pasted CR is that the resulting textfile which stores the configuration is actually saved in a corrupt way (i.e. all A records seem normally 1 line, and the record where the CR was pasted into is saved as two lines.
    When I edited the textfile to remove the surplus CarriageReturn, then suddenly I did see my lost zone back with all machines in it.

    Morale: do not paste something with newlines or carriage returns in the DNS fields

    • jlorre

      I also found that typing long information in the HINFO and TXT fields can totaly stop DNS in OSX 10.6.6 from working (without any warnings that I noticed). Once I removed all HINFO and TXT lines from /private/var/named/zones/db.LE.BE.zone.apple my DNS suddenly worked again. (for that i used: grep -v “IN HINFO” db.LE.BE.zone.apple | grep -v “IN TXT” >tempfile.txt; cp tempfile.txt db.LE.BE.zone.apple ) but first make a backup of db.LE.BE.zone.apple to keep the deleted information.
      The RFC mention a maximum length of 40 characters limited to letters,digits and dashes for HINFO fields. See e.g. http://www.rfc-editor.org/rfc/rfc1035.txt