2

I'm trying to figure out how to add records to my server's DNS from the command-line. I've investigated the 'serveradmin' tool, plus 'scutil', but neither appear to give me access to modify the DNS records.

Anyone know how I might be able to do this?

Thanks

1

1 Answer 1

1

I believe you can do it with serveradmin, but the syntax is horrid. The best way I know of is to edit the zone files directly (i.e. just append records to the end of them). How the zone files are organized depends on the version of OS X server you're using:

Through 10.6, there were two sets: /var/named/db.zonename. and /var/named/zones/db.zonename.zone.apple. The server admin interface manages the second files, so only add to them if you're adding record types it understands, and in the exact format it expects (and I mean exact -- I remember getting messed up once because I added records with the wrong number of spaces between fields). You can add anything you want to the first set of files, as long as it's in proper named format (but it won't be visible in the admin interface).

Lion 10.7 keeps everything in a single set of zone files, /var/named/db/zonename. I haven't experimented with it yet, but I'd assume you can at least add entries that the admin tools will understand.

3
  • From the documentation on serveradmin, it looks like it can turn the service on and off, but the PDF that I found (which was for 10.4 - I couldn't find the 10.5 one) didn't say anything about adding records. Adding them manually into the right file in /var/named/ looks perfect, though - thanks for that. I would vote you up, but as I'm new to ServerFault, I can't... Will mark you as the answer, though.
    – Hugh
    Nov 8, 2011 at 10:59
  • You can dump the DNS settings (including zone contents) with sudo serveradmin settings dns >settingsfile, edit settingsfile to include the new records, then use sudo serveradmin settings dns <settingsfile to load the changes. If you look at the file, you'll see what I mean by horrible. Nov 9, 2011 at 19:30
  • Wow - yeah - that's nasty... I think I'll stick with editing the files directly... Thanks!
    – Hugh
    Nov 27, 2011 at 23:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .