Sometimes you just need to force updates on slave DNS servers. The easiest way to do it is to increase zone serials on master server. what if there are hundreds of zone files? Here is one way to do it
Assuming we store DNS zones in /var/named and zone file names are in form domain.com.hosts, here is one liner that should effectively increase serial in all zones (set it to YYYYMMDD01 if it has some other format):
1 2 3 4 5 |
cd /var/named new_serial=`date +%Y%m%d01` ; for i in *.*.hosts; do serial=$(egrep -hE '[0-9]{9,10}' $i); sed -i 's/'"$serial"'/\t'"$new_serial"'/' $i ; done |
Note new_serial variable – it assumes that there is no zone with serial created from today timestamp. You can replace 01 with some higher number to make sure zones created today will be covered too.
0 Comments.