Articles in this section

How to change the IP address for a domain / all domains in Plesk

Plesk for Windows kb: how-to Plesk for Linux Ideal

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

Question

How to change the IP address for a domain / all domains in Plesk?

Answer

Note: In Plesk, domains assigned to a subscription will have IP address of this subscription. It is not possible to have domains with different IP addresses under one subscription.

  1. Log in to Plesk.
  2. Go to Domains > example.com > Hosting & DNS tab > Hosting.
  3. Scroll down to the IP Addresses section and select the required IP address.
  4. Click Save to apply the changes.




     

 

Command-line instructions:

Changing the IP address for one domain

 

  1. Connect to the Plesk server via SSH.

  2. 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
 (Linux) Changing the IP address for all domains

 

  1. Connect to the Plesk server via SSH.

  2. Generate a list of all subscriptions:

    # plesk bin subscription --list > /root/subscriptions.txt

  3. (Optional) Open the file /root/subscriptions.txt in a text editor and remove subscriptions, IP address of which should not be changed.

  4. 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
 (Windows Server) Changing the IP address for all domains

 

  1. Connect to the Plesk server via RDP.

  2. Start PowerShell as an Administrator.

  3. Generate a list of all subscriptions:

    PS plesk bin subscription -l > C:\subscriptions.txt

  4. (Optional) Open C:\subscriptions.txt and remove subscriptions, IP address of which should not be changed.

  5. 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
(Linux) Changing the IP address for all domains assigned to a specific IP 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.

  1. Connect to the Plesk server via SSH.

  2. 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='web' and ipa.ip_address='203.0.113.2'" > subscriptions.txt

  3. Assign te new IP address to all subscriptions listed in subscriptions.txt file:

    # while read i; do plesk bin subscription -u $i -ip 203.0.113.3; done < subscriptions.txt

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.