Bulk update DNS/BIND zone records

Hi everybody,

I had to do a mass update of dns records in our bind (on debian lenny).
I have no room for error and in my experience i know that bind is very sensitive syntax.
I specify you : i have no backup of the server, nsupdate is not installed on it and i'm not linux guru.
There is way (script) to do update from csv file like this:

RecordName, old IP, New IP, Type, DbZoneFile,action


Did you have a litle script to do this?
Georges OrwellSystem AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scripting this will take longer then actually using an editor on the system and updating the records in their respective files.

How is your DNS setup?  Do you have the data in files /var/named/db.mydomain.fr ...

look /etc/named/named.conf /etc/named/conf.d....

Is this for internal resolution or external?
nano/vi are the editors to use to open.
The only thing you need to do is to update the serial number depending on your existing notation by either incrementing it by one, or use the current date 2015070500
Then add  the records you want.
To comment a record out, place a semi-colon (;) in front of it.

Save the file
rndc reload mydomain.com after mydomin.com update
rndc reload mydomain.fr after the mydomain.fr update
and you are set.

A mass update deals with tens of zones that need to be updated.  And in a situation where there are tens of zones, an alternate storage/backend for DNS/BIND such as mysql/postgresql is an option.
Georges OrwellSystem AdministratorAuthor Commented:
Thanks for your response.

I have /var/cache/bind/db.mydomain.com
It's an externall resolution, we use windows AD/DNS for internal resolution.

I was hoping a solution of chaining grep, sed and awk, but I'm not comfortable with regular expressions.
for what you want I think a perl script is better, given you need to update the serial number.
The changes you are outlining require a script that will parse as well as validate data.

one deals with opening a file and building  an array/has such that you make all the updates for each domain once versus multiple times.  
this will happen if you do it a line at a time.

You might want to look at setting up cvs or subversion for versioning/backup schemes
you could use named-checkzone to validate the file prior to making it live.
i.e. use temporary file for the modified zone, validate it, then if passes, push it.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Carlos IjalbaIT Systems DirectorCommented:
A script will be good, but since I don't think you will do this very often, the best way is to use a text editor, you can do it all within vi.

However I recommend you to use something like MobaXTerm to connect to the unix box, and then edit the file within the text editor, you can use a normal search and replace box to do the changes.

You can also use Notepad++, but yuu will have to download the file and upload it back.

My preferred method is MobaXTerm. You can try the trial version, and if you like it purchase it, or delete it afterwards.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.