Editing the zone file

Invader Zim

Verified User
Joined
Sep 4, 2004
Messages
184
Would it be possible to be able to enter all changes to a zone file first and then only have to save once? And also be able to edit certain entries?

When someone mistakenly tries to add dns records to the zone to use google apps but forgets to put in the '.' at the end it'd be a lot easier editing the entries instead of deleting and recreating them.

And if we could do that with multiple entries at a time it'd be even easier.
 
You could edit them manually, but it might give some problems.
Because you can't only make a change, but you also have to take care that the change is "noticed" by the DNS servers around the world. So the record has to be updated. You can do this manually also, by adding +1 to the serial number and then restart bind.

However... I don't know if the DA control panel also keep records of serial changes some way.
If yes, then the newly made serial could be overwritten because DA does not see that it was changed. I don't know how DA works with that exactly, so maybe somebody else could tell you how DA handles it.

IMHO it would be a better idea to put this in as a suggestion in the suggestion thread, because I agree in several cases it's a lot easyer to only update a record then having to delete and add it again.
 
No, DirectAdmin doesn't save the zone serial number anywhere else but in the zone file. But it's still easy to mess it up (don't forget it's a mathematical add, not a concatenation). Several points:

DirectAdmin can update the zone file for you; this shell command will update serial numbers on all zone files and also restart BIND:
Code:
echo "action=rewrite&value=named" >> /usr/local/directadmin/data/task.queue
Thanks to John, who reminded me of this a few days ago.

Serial numbers are only important if you're using a true master-slave fonguration. They're definitely unimportant if you're using one nameserver with two IP#s to fool the DNS system (not recommended but lots of admins still ding it). They may not be important if you're using Multi-Server Option but they definitely ARE important if you're using Master2Slave DNS Replicator.

Then of course if you change how you do DNS and serial numbers become important you can always run that DirectAdmin shell command (see above) to get them synchronized again.

Zone file serial numbers do not have to be in any special format. If your zone file is 1 and you manually change it to 2 when you update a zone, that's good enough for BIND. The method DirectAdmin (and almost every admin out there uses today) use was probably first recommended by Cricket Liu in his definitive O'Reilly DNS handbook, DNS and Bind, in which he recommended using a serial number made so: yyyymmdd##, where yyyy is the four-digit year, mm is the two-digit month, dd is the two-digit day, and ## is a two-digit additive number.

DirectAdmin maintains the DNS serial number someting like this:

If it's recognizable according to the above format but is a date earlier than today, it uses today's date followed by the two-digit number 00. If the date is today's date, it increments it removes the two-digit number at the end, adds 1, and writes it back. I don't know what it does if the number isn't recognizable as a date, or if it's later than today (in which case using today's date would break the serial number) or if the additive number goes above 99 in which case adding 1 and turning it into a three digit number would break it, as would starting over again at 00.

If the number becomes broken there is a serial number you can send which tells BIND to start over; I don't recall it and have only had to use it once, many years ago.

And another point of interest, in case you don't know, BIND is an acryonym for Berkeley Internet Name Daemon; the program was originally written by four graduate students at the Computer Systems Research Group at the University of California, Berkeley (USA). Adaemon, as we computer admins should know, is a program which runs in the background, ready to do your bidding when asked.

I've often thought it would be easer on the Internet if serial numbers were only updated when all changes were finished; why keep passing update requests to slaves each time one line is changed or spelling is corrected? But the problem is in ensuring that you can't leave the page without specificing yes or no, that you want your changes saved.

Otherwise you could make a lot of changes, forget to commit them, and all your work is gone and tomorrow you'll wonder why no one can see your site. Or that you'll want to abandon your changes, think you can, by just leaving the page, and then find out later your changes were written anyway.

Jeff
 
I know how DNS works, just not if DA also did anything separate with it. So it's good to hear it doesn't. That command line though can come in handy, thanks!

But I like this a a suggestion.
So if DA is indeed not interfering, then this suggesion would be very easy to implement.
This could be done by a "save changes" button, which would just do what the commandline says.

This way people also can make more changes to one domain at the same time and save all changes to the zonefile, change serial and restart named by using that "save changes" button which triggers the DA command line.

That would be a very minor and easy to make implementation IMHO.
 
That would be a very minor and easy to make implementation IMHO.
Depends on what you mean by minor and easy. Currently DirectAdmin rewrites the zone file for each change; your suggestion would require DirectAdmin maintain either a temporary record of changes, or a separate copy it would write and rewrite, and then a copy command when you commit your changes. And the changes would still be all or nothing, unless you implemented an even more complex undo system.

And even more important, it would require some kind of notice to remind you if you try to leave the page without rewriting the zone file, to avoid unintntial change abandonment.

So far this discussion is only three people. Is anyone else interested?

Jeff
 
Hello,

I'd be interested in adding an "Edit" button for zones, similar to the edit button in the cronjobs.

However, I'm not sure if having DA make multiple changes per save is worth the coding effort..
Eg: I'm not currently seeing what the issue is with needing a few saves, also factoring in that the named reload is no more than every minute.. so even if you do a few changes in one go, usually, named only reloads once anyway (give or take)... but with the "Edit" button that would make much of it easier.

John
 
It's not making the changes, it's the fact that at the present time, you can't make changes.
You have to remove and then add again.

If it's easyer for you to change that behaviour by creating an edit button, it's fine with me too.
 
Back
Top