# Remapping IP Addresses

Содержание

In Plesk, services that enable website hosting, webmail, FTP access, and so on are bound to one or more of the server’s IP addresses. If that IP address is removed from the server, those services may become unavailable.

To avoid this, all services using a specific IP address can be made to use a different IP address instead. This is called IP address remapping, and is done using a CLI utility that updates all necessary configuration files. Once an IP address has been remapped, it can be removed from the Plesk server without causing any issues.

In this topic, you will learn how to remap IP addresses in Plesk.

## Общие сведения об обновлениях

Before removing one or more IP addresses from a Plesk server, for the hosted websites and Plesk services to keep working correctly, they must be remapped to a different IP address by updating the configuration files and the Plesk database. This is done using the `plesk bin ipmanage` CLI utility.

The IP address the websites and services are being switched from is called the source IP address. The one they are being switched to is called the target IP address.

IP address remapping can be done automatically or manually. Automatic remapping lets Plesk determine the best target IP address for each source IP address. Manual remapping uses a mapping file to control the way the source and target IP addresses are matched.

Примечание

IP address remapping may cause temporary issues with access to the websites that were hosted on the source IP address as the DNS changes propagate throughout the Internet. Usually, DNS propagation takes up to 48 hours.

To avoid this, you can temporarily decrease the SOA TTL value for those domains, wait until a period of time corresponding to the original TTL value has passed (by default, the TTL value in Plesk is 24 hours), perform IP remapping, and then restore the original TTL value.

Осторожно

If the authoritative DNS servers for the hosted websites use one or more IP addresses you plan to remap, make sure to update the glue records at the corresponding domain name registrars, or to advise the owners of the hosted websites to do so. The specific instructions differ depending on the registrar in question. For help, refer to the registrars“ documentation, or contact their support.

## Предварительные требования

Before remapping one or more IP addresses in Plesk, add the target IP address(es) to a server’s network interface and make sure that the server is reachable over the network via each target IP address. There is no need to register the target IP address(es) in Plesk - it will be done automatically during remapping.

Примечание

In Plesk for Windows, IP addresses cannot be remapped if the server’s network configuration is controlled by DHCP.

## Remapping IP Addresses Automatically

In simple cases, such as when one or more IP addresses are removed from a Plesk server, and an equal number of IP addresses of the same version are added to replace them, you can remap IP addresses automatically. This is the quicker option that requires no configuration, but it does not give you control over the way the source and target IP addresses are matched during remapping.

To remap one or more IP addresses automatically:

1. Log in to the Plesk server via SSH as the root user, or via RDP under an administrator account.

2. Run the following command in the shell or the command prompt to remap the IP address(es):

       plesk bin ipmanage --auto-remap

Once the remapping process has finished, the source IP address in the configuration files for the web, FTP, and mail servers and in the Plesk database will be updated to the target IP address. The DNS zones of the websites hosted on the source IP address will also be updated accordingly.

## Remapping IP Addresses Manually

If you want control over the way the source and target IP addresses are matched during remapping, you can remap IP addresses manually. You do so by generating and editing a mapping file.

To remap one or more IP addresses manually:

1. Log in to the Plesk server via SSH as the root user, or via RDP under an administrator account.

2. Run the following command in the shell or the command prompt to generate the mapping file:

   - Plesk для Linux:

         plesk bin ipmanage --remap /tmp/map_file

   - Plesk для Windows:

         plesk bin ipmanage --remap C:\Users\Administrator\map_file

   Here, the path to the mapping file can be replaced with any other path on the file system. The resulting mapping file contains all IP addresses present on all of the server’s network interfaces.

3. Edit the generated mapping file by first commenting out or removing the lines corresponding to IP addreses you do not want to remap, and then pairing the desired source and target IP addresses.

   For example, here’s what the mapping file may look like if you wanted to remap the IP address `198.51.100.1` bound to the `ens5` network interface (source IP address) to `198.51.100.2` bound to the same network interface (target IP address):

       ens5 198.51.100.1 255.255.255.0 -> ens5 198.51.100.2 255.255.255.0

   Here’s what the mapping file may look like if you wanted to remap the IP address `2a05:d018:3c0:ef29:899f:e173:b56:a0c4` bound to the `Ethernet 3` network interface (source IP address) to `2a05:d018:3c0:ef29:aa95:4aa4:7d84:6db5` bound to the same network interface (target IP address):

       "Ethernet 3" 2a05:d018:3c0:ef29:899f:e173:b56:a0c4 128 -> "Ethernet 3" 2a05:d018:3c0:ef29:aa95:4aa4:7d84:6db5 128

   Примечание

   You cannot remap an IPv4 address to an IPv6 address, or vice versa.

4. Run the following command to remap the IP address(es):

   - Plesk для Linux:

         plesk bin ipmanage --remap /tmp/map_file

   - Plesk для Windows:

         plesk bin ipmanage --remap C:\Users\Administrator\map_file

Once the remapping process has finished, the source IP address in the configuration files for the web, FTP, and mail servers and in the Plesk database will be updated to the target IP address. The DNS zones of the websites hosted on the source IP address will also be updated accordingly.