Applicable to:
- Plesk for Linux
- Plesk for Windows
Symptoms
-
An attempt to remove IP address in Tools & Settings > IP Addresses fails:
The IP address 203.0.113.2 is already used for hosting
-
DNS service is not installed or disabled on the server:
# plesk bin server_dns --info
The DNS service is not installed.
Cause
Plesk bug PPPM-11183 that is planned to be fixed in one of the next Plesk updates.
Plesk doesn't update the records in its database in case the DNS service is disabled/not installed.:
# plesk db "SELECT d.name,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 = 'mail' and ipac.ipAddressId = (select id from IP_Addresses where ip_address='203.0.113.2') GROUP BY d.name ASC;"
+-------------+----------------+
| name | ip_address |
+-------------+----------------+
| example.com | 203.0.113.2 |
+-------------+----------------+
Resolution
Until the bug is fixed, use the following workaround to switch mail to another IP address and to be able to remove the IP address:
-
Connect to the server using SSH.
-
Find the domains using the IP address to be removed:
# plesk db "SELECT d.name,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 = 'mail' and ipac.ipAddressId = (select id from IP_Addresses where ip_address='203.0.113.2') GROUP BY d.name ASC;"
+-------------+----------------+
| name | ip_address |
+-------------+----------------+
| example.com | 203.0.113.2 |
+-------------+----------------+ -
Find the IP address used for web hosting on this domain:
# plesk bin domain --info example.com | grep -i "IP address"
IP address: 203.0.113.3 -
Select the option Send from domain IP addresses in Tools & Settings > Mail Server Settings > Outgoing mail mode and click OK at the bottom of the page to apply the change.
-
Update the domain to use the same IP for web and mail hosting:
-
for one domain:
# plesk bin domain -u example.com -mail-service-ip 203.0.113.3
-
for all affected domains:
# for i in $(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 = 'mail' and ipac.ipAddressId = (select id from IP_Addresses where ip_address='203.0.113.2') GROUP BY d.name ASC;"); do plesk bin domain -u $i -mail-service-ip 203.0.113.3; done
Note: Replace the IP address 203.0.113.2 in the above command with the one to be removed, and 203.0.113.3 with the one to be used instead for mail hosting.
-
-
Roll back to the previous setting in Tools & Settings > Mail Server Settings > Outgoing mail mode and click OK at the bottom of the page to apply the change.
-
Connect to the server using RDP.
-
Create a file with the list of affected domains where the IP address to be removed is used for hosting mail:
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 = 'mail' and ipac.ipAddressId = (select id from IP_Addresses where ip_address='203.0.113.2') GROUP BY d.name ASC" > domains.list
-
Change the IP address to be removed for domains from the list to the proper one:
for /F %i in (domains.list) do plesk bin domain -u %i -mail-service-ip 203.0.113.3
Note: In steps 3 and 4, replace the IP address 203.0.113.2 in the command with the one to be removed, and 203.0.113.3 with the one to be used instead for mail hosting.
Comments
0 comments
Please sign in to leave a comment.