Skip to main content

Problem with mass change of TTL and Serial Number

Comments

3 comments

  • mirchevideas
    Hi, I solved this problem and you can close this topic. What I do: 1. Log on the server as root via SSH 2. cp -a /var/named/chroot/var/named/ /var/name/chroot/var/named-backup 3. cd /var/named/chroot/var/named/ 4. perl -pi -e "s/14400/60/g" *.db 5. perl -pi -e "s/86400/60/g" *.db 6. sed -i s/'[0-9]\{10\}'/`date +%Y%m%d%H`/ *.db 7. rndc reload 8. service named restart And now everything looks great :) Best regards, Mirchev Ideas Team
    0
  • cPanelMichael
    Hello :) I am happy to see that you were able to resolve the issue. Thank you for updating us with the outcome.
    0
  • Havri
    Hello, Sorry for posting on this resolved topic. Just wanted to post an actual bash script that uses mirchevideas's method to change TTLs and serials on the local server + syncing with the DNS cluster using main_domain file from /var/cpanel/userdata/: #!/bin/bash now=$(date +"%m_%d_%Y_%H_%M") echo "Making backup of DNS zones" cp -R /var/named /var/named_bak_$now sleep 2; echo "Changing TTL values" ## These are our custom values. Everybody should change these values to fit their needs. If you have 86400, you should set the below settings accordingly. ## From 1800 -> 300; From 3600 -> 240 perl -pi -e "s/1800/300/g" /var/named/*.db perl -pi -e "s/3600/240/g" /var/named/*.db sleep 3; echo "Changing zone serial date" sed -i s/'[0-9]\{10\}'/`date +%Y%m%d%H`/ /var/named/*.db sleep 3; rndc reload service named restart sleep 3; echo "Syncing modified zones to DNS Cluster" grep -r 'main_domain:' /var/cpanel/userdata/ | awk '{print $2}' | sort | while read DOMLIST; do echo "Now syncing ${DOMLIST} zones.."; /scripts/dnscluster synczone ${DOMLIST}; sleep 2; done echo "All done! Just to be sure, please check values in the DNS Sync-only servers."
    Thank you.
    0

Please sign in to leave a comment.