Tag Archives: dns

Mass changing TTL values in named

This is mostly a note to self – if you need to mass change the TTL value for a zone in named, when for example you need to change the IPv4 addressing scheme for your DNS servers, here is a simple way to do it. The script assumes that you have the "; Serial" comment after the serial number of the zone. The script runs inside the primary zone folder:

# cat changettl 

for z in $(ls -1| grep -v jnl); do 
        echo '$TTL 600' > newzone
        tail -n +2 $z | sed -r 's/^(\s+).*serial.*$/\12011040503 ; Serial/i' >> newzone
        mv newzone $z

It is quite dirty but works for me.

Tagged , ,