- Plesk for Linux
- Plesk for Windows
It is impossible to delete the IP address via Tools & Settings > IP Addresses > 203.0.113.2 > Remove:
PLESK_ERROR: Error: The IP address
203.0.113.2is already used for hosting.
There are no domains assigned to this IP address
Previously, there were domains on this IP address, but they were switched to Forwarding or No Hosting hosting type in Domains > example.com > Hosting Settings
In Tools & Settings > Mail Server Settings > Outgoing mail mode is set to Send from domain IP addresses.
It is a Plesk bug #PPPM-8945 which is going to be fixed in the future updates.
Until a fix becomes available, use the following workarounds to switch mail to another IP address:
- Connect to the server via SSH
Create a list with the subscriptions assigned to the old IP address:
# OLDIPADDRESS="203.0.113.2"; plesk db -Nse "SELECT d.name 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 = (select id from IP_Addresses where ip_address='$OLDIPADDRESS') GROUP BY d.name ASC" > subscriptions.list
OLDIPADDRESSvalue with the IP address that is needed to be removed from Plesk.
Change affected subscriptions with the new IP address:
# cat subscriptions.list | while read i; do plesk bin subscription -u $i -ip <new-ip-address> -mail-service-ip <new-ip-address> ; done
Note: Where <new-ip-address> is one of the IP addresses existing in Plesk, and not the one that is needed to be removed.