Plesk

How to bulk update the IP address in multiple DNS A records?

Question

At the moment, multiple DNS A records for one or several domains in Domains > example.com > DNS Settings are set to IP address 203.0.113.2. How to automatically update all of them to the new IP address 203.0.113.3?

Answer

  1. Connect to the server:

  2. Create a backup of
    psa
    database:

    # plesk db dump psa > psa_backup.sql

    Note: additional information about backup creation can be found in this article.

  3. Update the A records to a new IP address (in this example, 203.0.113.2 is the current IP address, and 203.0.113.3 is the new one - replace them with actual values):

    • For a specific domain, e.g. example.com:

      # plesk db "update dns_recs set val='203.0.113.3', displayVal='203.0.113.3' where host like '%example.com%' and type='A' and displayVal='203.0.113.2';"

    • For all domains on the server:

      # plesk db "update dns_recs set val='203.0.113.3', displayVal='203.0.113.3' where type='A' and displayVal='203.0.113.2';"

  4. Use the plesk repair dns utility to update DNS configuration files:

    # plesk repair dns -y

Exit mobile version