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)


  1. Install Node.JS if it's not already on the system:
  2. Download the script:
  3. Make it executable
  4. (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)

GPL License

Feel free to copy this script and make modifications.

Written by Juli 26, 2017.

Follow me via RSS:   RSS https://z├Ąta.com/rss_en.xml (copy to feed-reader)
or Github:   Github https://github.com/Z3TA