Applicable to:
- Plesk for Linux
Question
How to change IP addresses for multiple subscriptions using CLI?
Answer
-
Connect to the server via SSH;
-
Use the
subscription
utility to change the IP's for all subscriptions available:-
For IPv4 addresses only:
# for sub in `plesk bin subscription -l`; do plesk bin subscription -u $sub -ip 203.0.113.2; done
-
For both IPv4 and IPv6 addresses:
# for sub in `plesk bin subscription -l`; do plesk bin subscription -u $sub -ip 203.0.113.2,2001:db8:f61:a1ff:0:0:0:80; done
Note: the feature of configuring IPv6 addresses separately via CLI is not implemented it Plesk yet. Take part in our product improvement by referring to the following link: https://plesk.uservoice.com/forums/184549-feature-suggestions
-
Warning: both IP addresses, have to be present in Tools & Settings > IP Addresses list.
-
Connect to the server via SSH;
-
Create the list of all subscriptions on a server, which IP-addresses are equal to 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='web' and ipa.ip_address='203.0.113.2'" > list
-
Use the
subscription
utility to change the IP's for all subscriptions in thelist
file to 203.0.113.3:# while read i; do plesk bin subscription -u $i -ip 203.0.113.3; done< list
Warning: In case there are resellers using IP 203.0.113.2, launching the command above will lock them and they will not be able to synchronize with their Service Plans. In order to avoid this, add new IP address to resellers service plan first.
For example, the following command will add the address to "Default Reseller" Service Plan pool:# plesk bin reseller_plan --update 'Default Reseller' -ip_pool add:203.0.113.3
Comments
0 comments
Please sign in to leave a comment.