Unable to remove an IP address from Tools & Settings > IP Address: IP address cannot be removed because it is used by DNS zone of one or more domains

Created:

2016-11-16 12:52:21 UTC

Modified:

2017-08-16 17:30:43 UTC

3

Was this article helpful?


Have more questions?

Submit a request

Unable to remove an IP address from Tools & Settings > IP Address: IP address cannot be removed because it is used by DNS zone of one or more domains

Applicable to:

  • Plesk 10.x for Linux
  • Plesk 12.5 for Linux
  • Plesk Onyx for Linux
  • Plesk 11.x for Linux
  • Plesk 11.x for Windows
  • Plesk 12.0 for Windows
  • Plesk 12.0 for Linux
  • Plesk 12.5 for Windows
  • Plesk 9.x for Linux

Symptoms

It is not possible to delete an IP address from Tools & Settings > IP Address .

The following error is shown:

Error: IP address <ip> cannot be removed because it is used by DNS zone of one or more domains

Cause

This issue is caused by an inconsistency in the psa database.

Resolution

  1. Create a backup of the current psa database:

    Windows:

    "%plesk_dir%\MySQL\bin\mysqldump.exe" -uadmin -P8306 -p<PleskPasswordHere> psa > c:\psadump.sql

    Linux:

    mysqldump -uadmin -p`cat /etc/psa/.psa.shadow ` psa > /tmp/psa.`date +%F_%H.%M`.sql
  2. Find the domains whose DNS zones prevent the IP address from being deleted:

    mysql> set @ip_address := '203.0.113.2';
    
    mysql> select d.name as DomainName, dnsr.type, dnsr.host, dnsr.id as DNS_record_ID from domains as d join dns_recs as dnsr on d.dns_zone_id=dnsr.dns_zone_id where dnsr.val=@ip_address;
  3. For each domain shown in the output, go to Plesk > Domains > example.com > Manage hosting > Websites & Domains > DNS Settings and remove the corresponding record.

    If the query on Step 2 returns empty result, it means that domains were deleted, however DNS records about IP address left in Plesk database. Find records that contains IP address in question in psa.dns_recs table and delete them manually:

    mysql> set @ip_address := '203.0.113.2';
    
    select id, type, host, val from dns_recs where val=@ip_address;
    delete from dns_recs where val=@ip_address;

If the issue appeared after switching all subscriptions to a new IP, DNS records may have not been updated properly. In this case, look up the outdated entries in the dns_recs table:

mysql> SELECT * from `dns_recs` WHERE `val` = '<old_ip>';

All of them need to be updated (the old IP in val should be changed to something else) before this IP can be deleted.

To fix visual representation (in the Plesk web interface), executing the following query may be needed:

mysql> UPDATE `dns_recs` SET `displayVal` = `val` WHERE `val` <> `displayVal`;
Have more questions? Submit a request
Please sign in to leave a comment.