Applicable to:
- Plesk for Linux
Question
How to replace IP address for domains/clients/resellers in Plesk for Linux?
Answer
Switch all existing domains to a single IP address that exists in system:
-
Run the following command:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -Ns -uadmin -D psa -e 'select name from domains' | awk '{print "/usr/local/psa/bin/domain --update " $1 " -ip <ip_address> "}' | sh
Note: <ip_address> here is the IP address that will be used instead of the current one. This IP must exist in the system.
Perform a more complex IP address replacement:
-
Make sure that the new IP addresses are not registered in Plesk on the Plesk > Tools & Settings > IP Addresses page. If they are, remove them before proceeding further;
-
Run the utility
reconfigurator.pl
to create the mapping template file:# /usr/local/psa/bin/reconfigurator.pl ipaddresses.map
-
Edit this file and set the appropriate IP mapping. The mapping file matches the full list of the currently configured IP addresses with new ones in the following format:
CONFIG_TEXT: eth0:192.0.2.2 255.255.255.0 -> eth0:192.0.2.2 255.255.255.0
eth0:192.0.2.3 255.255.255.0 -> eth0:192.0.2.3 255.255.255.0Edit the file and replace an IP address in the right part of a string with one from the new set:
CONFIG_TEXT: eth0:192.0.2.2 255.255.255.0 -> eth0:new_ip_address 255.255.255.0
-
Once the mapping file contains an appropriate arrangement, run
reconfigurator.pl
again:# /usr/local/psa/bin/reconfigurator.pl ipaddresses.map
It will read the mapping file and perform the replacement according to its content.
-
Rebuild configuration for Plesk services:
-
For Plesk 12.5 and newer
# plesk bin repair -r
-
For Plesk 12.0 and below:
# /usr/local/psa/bin/repair -r
Note: reconfigurator.pl script updates IP addresses in Plesk, but does not do anything with server network interface. If old IP address(es) are not needed any more, remove them from the network interface manually.
-
Comments
0 comments
Please sign in to leave a comment.