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.

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..

errant-zone-in-server-admin

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:

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.

I'm into everything technology related, particularly anything Apple related. I enjoy programming and tend to lean towards server-based technologies over client-based. You can contact me on twitter, via e-mail, or follow me on friendfeed.