
You need to migrate, change IP or DNS but afraid of downtime and dns propagation ?
This is a quick way to change TTL on all zones and after that serials so you can reload all zones.
Changing TTL:
for a signle zone :
1 |
find . -name "nixpal.com.db" -exec sed -i "s/14400/1800/g" '{}' \; |
It will change the default 14400 (4 hours) TTL to half an hour. You can edit 1800 to a lower number if you want like 600.
for all zones:
1 |
find . -name "*.db" -exec sed -i "s/14400/1800/g" '{}' \; |
Now the “hard” part.
Changing serials.
On a perfect world serial is just a date. Syntax is year-month-day-2 more digits.
But a few systems doesn’t follow this rule. Anyway this example will change the serial to the date we have today.
1 |
sed -i s/'[0-9]\{10\}'/`date +%Y%m%d%H`/ *.db |
Bulkd RNDC RELOAD:
You cal also use this command to bulk reload all zones in bind. As input I use /etc/localdomains that cPanel uses for its domains.
Other platforms may have another text files for this job. Replace if needed.
1 |
while read in; do rndc reload "$in"; done < /etc/localdomains |