Update IP in zone files
The other day I needed to update a IP in a bunch of bind/named DNS zone files. It's a bit more complicated then a "awk" one liner though,
because you also need to update the serial number in the SOA recrod!
I did a Google search but didn't find any solutions, so I wrote my own script!
Here it is: update_ip_in_zone_files.js (<--right click to download)
- Install Node.JS if it's not already on the system:
- Download the script:
- Make it executable
- (Uptional): Edit the script and replace DEFAULT_ZONE_FILE_LOCATION with the path to your zone files.
Run in bash/sh shell:
Or via node or nodejs:
From a node.js script:
From a bash script:
Don't forget to reload bind/named to trigger notify to dns slave servers!
(bind is sometimes called named)
Feel free to copy this script and make modifications.
Written by Johan Zetterberg Juli 26, 2017.