[Tool] ISPConfig DNS TTL Bulk Migration Script (Backup + Rollback) – useful for server migrations /

Discussion in 'Tips/Tricks/Mods' started by Andreas Friedrich, Mar 7, 2026 at 4:45 AM.

  1. Andreas Friedrich

    Andreas Friedrich New Member

    Hello everyone,

    while preparing a migration of my ISPConfig hosting environment to a new server infrastructure including an upgrade to Debian 13, I needed a reliable way to reduce the TTL of many DNS records at once.

    Lowering the TTL before a migration is a common best practice because it ensures that DNS changes (for example switching services to new server IPs) propagate quickly when the actual migration happens.

    Since I could not find a simple tool that performs this safely inside ISPConfig, I created a small script and decided to share it with the community.

    GitHub Repository
    The script is available here:
    https://github.com/TheLegeres71/ISPConfig-DNS-TTL-Migration-Script
    Feel free to use it, adapt it to your environment or suggest improvements.

    What the Script Does
    The script performs a safe bulk update of DNS TTL values directly inside the ISPConfig database.
    It only modifies record types that are typically relevant during server migrations while leaving critical DNS infrastructure records untouched.

    Features
    • Bulk update DNS TTL values
    • Updates only the following record types:
      • A
      • AAAA
      • CNAME
      • MX
    • NS records remain unchanged
    • Automatic database backup before any modification
    • Rollback functionality
    • Dry-run mode to preview affected records
    • Works in ISPConfig cluster environments
    • Designed specifically for migration preparation
    Typical Migration Workflow
    In my case the migration workflow looks like this:
    1. Reduce TTL values to 300 seconds
    2. Wait 24–48 hours so the lower TTL propagates
    3. Perform the server migration
    4. Update DNS records to the new server IP addresses
    5. Restore higher TTL values once the migration is complete
    Reducing TTL beforehand allows DNS changes during the migration window to propagate within minutes instead of hours.

    Example Output

    Example dry-run output:
    Code:
    ISPConfig DNS TTL Migration Script
    ----------------------------------
    
    Records that will be updated:
    
    A       842
    AAAA    21
    CNAME   312
    MX      94
    This allows administrators to quickly verify how many records will be affected before executing the migration.

    Example Usage

    Run a dry-run first (recommended):

    Code:
    ./ispconfig-dns-ttl-migration.sh dry-run
    Execute the migration:

    Code:
    ./ispconfig-dns-ttl-migration.sh run
    Rollback if required:

    Code:
    ./ispconfig-dns-ttl-migration.sh rollback /path/to/backup.sql
    Important Notes
    • Execute the script only on the ISPConfig master/panel server
    • Do not run it on DNS slave nodes
    • Always run dry-run first
    The script automatically creates a backup of the DNS tables before applying changes so the original state can easily be restored.

    Possible Future Improvements

    For a future version I am considering adding features such as:
    • domain filtering
    • automated DNS IP replacement during migrations
    • DNS propagation checks
    If anyone has suggestions for additional migration features (especially for large ISPConfig environments), I would be happy to extend the tool. Feedback and improvements are very welcome.

    Best regards
    Andreas
     
    Taleman likes this.

Share This Page