Question
How to change the IP address for a domain / all domains in Plesk?
Answer
-
Go to Domains > example.com > Hosting & DNS tab > Hosting.
-
Scroll down to the IP Addresses section and select the required IP address.
-
Click Save to apply the changes.
Command-line instructions:
-
Connect to the Plesk server via SSH.
-
Execute the following command:
-
to change IPv4 only:
# plesk bin subscription --update example.com -ip 203.0.113.3
where:
-
example.com
- domain name -
203.0.113.3
- new IP address
-
-
to change IPv4 and IPv6:
# plesk bin subscription --update example.com -ip 203.0.113.3,2001:db8:f61:a1ff:0:0:0:80
where:
-
example.com
- domain name -
203.0.113.3
- new IP address -
2001:db8:f61:a1ff:0:0:0:80
- new IPv6 address
-
-
-
Connect to the Plesk server via SSH.
-
Generate a list of all subscriptions:
# plesk bin subscription --list > /root/subscriptions.txt
-
(Optional) Open the file
/root/subscriptions.txt
in a text editor and remove subscriptions, IP address of which should not be changed. -
Execute the following command:
-
to change IPv4 only:
# cat /root/subscriptions.txt | while read i; do plesk bin subscription -u $i -ip 203.0.113.3 ; done
where:
-
203.0.113.3
- new IP address
-
-
to change IPv4 and IPv6:
# cat /root/subscriptions.txt | while read i; do plesk bin subscription -u $i -ip 203.0.113.3,2001:db8:f61:a1ff:0:0:0:80 ; done
where:
-
203.0.113.3
- new IP address -
2001:db8:f61:a1ff:0:0:0:80
- new IPv6 address
-
-
-
Connect to the Plesk server via RDP.
-
Start PowerShell as an Administrator.
-
Generate a list of all subscriptions:
PS plesk bin subscription -l > C:subscriptions.txt
-
(Optional) Open
C:subscriptions.txt
and remove subscriptions, IP address of which should not be changed. -
Execute the following command:
-
to change IPv4 only:
PS more C:subscriptions.txt | % { if ($_) { plesk bin subscription --update $_ -ip 203.0.113.3 } }
where:
-
203.0.113.3
- new IP address
-
-
to change IPv4 and IPv6:
PS more C:subscriptions.txt | % { if ($_) { plesk bin subscription --update $_ -ip 203.0.113.3,2001:db8:f61:a1ff:0:0:0:80 } }
where:
-
203.0.113.3
- new IP address -
2001:db8:f61:a1ff:0:0:0:80
- new IPv6 address
-
-
In the example below, the subscriptions that are assigned to IP address 203.0.113.2 will be switched to new IP address 203.0.113.4.
Note: In case there are resellers using IP address 203.0.113.2, launching the command below will lock them and they will not synchronize with their Service Plans.
-
Connect to the Plesk server via SSH.
-
Generate a list of all subscriptions which are currently assigned to a specific IP address (in this example, it is 203.0.113.2):
# plesk db -Ne "select d.name from IP_Addresses ipa join IpAddressesCollections ipac on ipac.ipAddressId=ipa.id join DomainServices ds on ds.ipCollectionId=ipac.ipCollectionId join domains d on d.id=ds.dom_id join Subscriptions s on s.object_id=d.id where ds.type='…