Mass IP changing in Plesk

This is particularly useful when migrating to a NAT environment on a Plesk server with a large number of domains on a single shared IP, or migrating from one IP to another.

First you need to add the IP address on the server, and ensure that it's been picked up by the Plesk control panel. After that, go into the psa database:

mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa

The IP addresses are stored in the IP_Addresses table... we need to get the id of the OLD IP address, and the NEW IP address:

mysql> SELECT * FROM IP_Addresses;

Once these are noted, we need to add the new IP to any virtual host that doesn't have it already:
mysql> UPDATE Repository SET component_id = [new ip id] WHERE component_id = [old ip id];

Then we need to switch the new ip to be the active on for each domain still on the old one:
mysql> UPDATE hosting SET ip_address_id = [new ip id] WHERE ip_address_id = [old ip id];

Plesk stores forwarding domains in a different table, so you may also need to update the 'forwarding' table similarly. It is laid out exactly like hosting, so the same query will work, substituting 'forwarding' for 'hosting'.

Submitted by jkelly on Sat, 2006-08-12 03:55. categories [ | ] login or register to post comments