ispmanager 6

/
/
How to change the IP address of your panel

How to change the IP address of your panel

Why?

  • To change the server IP address
  • To change the primary IP address of the panel

Instructions

PLEASE NOTE!

Do not remove the initial IP address of the panel until all settings are completed.

Before changing the server IP address

First, add the future IP address to the panel:

  1. Go to Settings section - IP addresses
  2. Click the Create button
  3. Enter a new IP address and click the Create button.

Now, the new IP address can be assigned to the panel.

  1. Go to the Settings section - Panel settings
  2. In the opened tab, click the Add button in the Panel address section
  3. Fill in the following fields:
    1. IP address - the new IP address added earlier
    2. Port - specify the port number to accept incoming connections. If the field is left empty, the default value will be used
    3. Forbid HTTP connections - the built-in web server can accept requests via HTTP and HTTPS protocols; check the box if you want to prohibit HTTP requests. In this case they will be automatically redirected to HTTPS
  4. Click the Create button.

In case it's required to change the IP address of the server, the IP addresses of all panel entities should be changed as well:

  • Domains in the DNS management section
  • Websites in the Sites section
  • Mail domains in the Mail section - Mail domains
  • Database servers in the Database section - Database servers
  • The hostlist relay_from_hosts parameter in the Exim configuration file.

If the server IP address has been changed

If the server IP address has been changed without prior preparation of the panel, the situation can be corrected by running the script. The script can be found at /usr/local/mgr5/sbin/change_server_ip.sh.

To replace the old IP address with a new one in all the necessary configuration files, specify the old and new IP addresses as parameters for the script:

/usr/local/mgr5/sbin/change_server_ip.sh <old-ip-address> <new-ip-address>

More information about how the script works can be found in the output of the following command:

/usr/local/mgr5/sbin/change_server_ip.sh --help

If the native database server previously used an old IP address for operation (not localhost, 127.0.0.1 or 0.0.0.0), replace the IP address in its configuration files.

You will also need to recreate the alternative DBMS created by the panel tools, the databases will be saved.

Correcting the IP address manually

If the server IP address was changed without prior preparation of the panel and the panel does not support the built-in IP address change script, you will have to make changes manually.

Correcting the IP address of the panel web server

  1. Get the old IP address for the panel's built-in web server with the following command:
    grep ip /usr/local/mgr5/etc/ihttpd.conf | grep "^[^#*]"
  2. Replace the old IP address with the new one by running the command:
    sed -i "s/<old-ip-address>/<new-ip-address>/g" /usr/local/mgr5/etc/ihttpd.conf
  3. Restart the built-in web server:
    systemctl restart ihttpd

Make sure that the web server service has started successfully. If the output of the command below is “Active: active (running)”, the web server service has started successfully:

systemctl status ihttpd

After this, the web interface of the panel will become available.

Correcting Nginx virtual host IP addresses

  1. Replace the previous IP address with the current one for all Nginx hosts by running the following command:
    sed -i "s/<old-ip-address>/<new-ip-address>/g" /etc/nginx/vhosts/*/*
  2. Check other Nginx configuration files for the old IP address:
    grep -r <old-ip-address> /etc/nginx | grep "^[^#*]"
  3. Replace the old IP address with the new one in all the configuration files that were obtained in the output of the previous step:
    sed -i "s/<old-ip-address>/<new-ip-address>/g" <path-to-file>
  4. Restart the Nginx web server:
    systemctl restart nginx

Make sure that the web server service has started successfully. If the output of the command below is “Active: active (running)”, the web server service has started successfully:

systemctl status nginx

Correcting Apache virtual host IP addresses

  1. Replace the previous IP address with the current one for all Apache hosts by running the following command:
    sed -i "s/<old-ip-address>/<new-ip-address>/g" /etc/apache2/vhosts/*/*
  2. Check other Apache configuration files for the old IP address:
    grep -r <old-ip-address> /etc/apache2 | grep "^[^#*]"
  3. Replace the old IP address with the new one in all the configuration files that were obtained in the output of the previous step:
    sed -i "s/<old-ip-address>/<new-ip-address>/g" <path-to-file>
  4. Restart the Apache web server:
    systemctl restart apache2

Make sure that the web server service has started successfully. If the output of the command below is “Active: active (running)”, the web server service has started successfully:

systemctl status apache2

PLEASE NOTE!

In RHEL-based operating systems, the Apache web server directory and service are called “httpd”.

Correcting the IP address in other files

If the mail server is installed, replace the IP address in the Exim configuration file:

sed -i "s/<old-ip-address>/<new-ip-address>/g" /etc/exim4/exim4.conf.template

For RedHat-based operating systems, the path to the Exim configuration file is different /etc/exim/exim.conf.

If the native database server previously used the old IP address for operation (not localhost, 127.0.0.1 or 0.0.0.0), replace the IP address in its configuration files.

You will also need to recreate the alternative DBMS created by the panel tools, the databases will be saved.

PLEASE NOTE!

Before recreating alternative DBMS, it is recommended to make backup copies, which are located at /var/lib/ and /var/ispmysql.

To check if the old IP address is in the MySQL configuration file, run the following command:

grep -r <old-ip-address> /etc/mysql | grep "^[^#*]"

Replace the old IP address with the new one in each file that was listed in the output of the previous command:

sed -i "s/<сold-ip-address>/<new-ip-address>/g" <path-to-file>

Actions in the panel

Change the IP address for all panel entities in the following sections:

  • Domains in the DNS management section
  • Sites in the Sites section
  • Database servers in the Databases - DB servers section, if remote access to them was enabled
  • Mail domains in the Mail - Mail domains section.