Unable to remove an IP address "Error: The IP address is already used for hosting"

Refers to:

  • Plesk for Windows
  • Plesk for Linux

Created:

2016-11-16 12:40:59 UTC

Modified:

2017-02-16 04:53:12 UTC

2

Was this article helpful?


Have more questions?

Submit a request

Unable to remove an IP address "Error: The IP address is already used for hosting"

Symptoms

An attempt to delete an IP address from Plesk fails with the following error:

Error: The IP address `<ip_address>` is already used for hosting.

However, in Tools & Settings > IP Addresses , no sites are shown to use this IP address.

Cause

This is caused by a Plesk database inconsistency. The psa.IpAddressesCollections table was not correctly updated when IP addresses were changed for domains.

Resolution

  1. Create a backup of 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 out which " id " is assigned to the IP address in question, and find any (sub)domains that have this IP address assiged:

    mysql> select @ip_id := id from IP_Addresses where ip_address='10.10.10.10';
    mysql> SELECT d.name, d.webspace_id, ipac.ipCollectionId,ds.type,ip.ip_address FROM DomainServices ds INNER JOIN IpAddressesCollections ipac ON ds.ipCollectionId = ipac.ipCollectionId INNER JOIN domains d ON d.id = ds.dom_id JOIN IP_Addresses ip on ipac.ipaddressid=ip.id WHERE (ds.type = 'web' OR ds.type = 'mail') and ipac.ipAddressId = @ip_id;

    Make sure the 10.10.10.10 IP address is replaced with the one to be deleted.

  3. Find records in the IpAddressesCollections table that correspond to the IP address in question:

    mysql> select * from IpAddressesCollections where ipaddressid=@ip_id;
  4. Find out which id is assigned to the IP address that should be used for the (sub)domains from the previous output, then update the corresponding records of the IpAddressesCollections table:

    For example, the 10.10.10.11 IP address should be assigned to example.com :

    mysql> set @domain_name := 'example.com';
    mysql> select @ip_id_new := id from IP_Addresses where ip_address='10.10.10.11';
    mysql> update IpAddressesCollections ipac INNER JOIN DomainServices ds ON ds.ipCollectionId = ipac.ipCollectionId INNER JOIN domains d ON d.id = ds.dom_id JOIN IP_Addresses ip on ipac.ipaddressid=ip.id set ipac.ipAddressId=@ip_id_new WHERE (ds.type = 'web' OR ds.type = 'mail') and ipac.ipAddressId = @ip_id and d.name=@domain_name;
Have more questions? Submit a request
Please sign in to leave a comment.