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

Created:

2016-11-16 12:40:59 UTC

Modified:

2017-08-16 13:25:38 UTC

5

Was this article helpful?


Have more questions?

Submit a request

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

Applicable to:

  • Plesk for Windows
  • Plesk for Linux

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. Back up Plesk database

2. Login to MySQL server

3. Find out which " id " is assigned to the IP address in question, and find any (sub)domains that have this IP address assigned:

MYSQL_LIN: mysql> select @ip_id := id from IP_Addresses where ip_address='203.0.113.2';
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 203.0.113.2 IP address is replaced with the one to be deleted.

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

MYSQL_LIN: mysql> select * from IpAddressesCollections where ipaddressid=@ip_id;

5. 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 203.0.113.3 IP address should be assigned to example.com :

MYSQL_LIN: mysql> set @domain_name := 'example.com';
mysql> select @ip_id_new := id from IP_Addresses where ip_address='203.0.113.3';
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.