ISPConfig 3.0.5 – rewrite ip on mirror(s) 3

I recently posted my solution for rewriting IP-addresses on mirrors here. Since yesterday ISPConfig 3.0.5 is available.
The patch works with, too.

Contrary to the old solution, there is now a patch available. You can now setup the IPv6-rewrite within the Interface. There is no IPv4 rewrite via the interface, as this should be implemented in 3.0.6. It also requires a different approach.

A rewrite of IPv4 addresses will continues to be controlled by the patch on /usr/local/ispconfig/server/lib/ and is only valid if the IP is not a wildcard. See at the end of the post.

I use the rewrite for several months on my servers. They all have a 64er subnet and the vhosts are written correctly on each mirror. I assume that the whole system works flawlessly on others. However, it should be checked after the first run, if the IPv6 was on the mirror set correctly. For example, by

grep "\<VirtualHost \[" /etc/apache2/sites-enabled/

For problems (and also with non-problems;)) please use the comment function or send me an email to


How it works
Under Serverconfig is a new field “IPv6 Prefix” available. Here the IPv6 prefix of the server is entered (for a 64er subnet eg 2a01:4f8:150:2262 ::). When writing to a mirror of the vhost, then IPv6 is replaced in part by the subnet. Suppose the mirror has the subnet 2a01:4f8:150:aaaa::, then on the mirror the (master) IPv6 2a01:4f8:150:2262::1 will be changed to 2a01:4f8:150:aaaa::1.

As long under Serverconfig / Web option “Rewrite IPv6 on Mirror” is not selected, there is no rewrite, and the IPv6 is written identically to the master. So you can decide per mirror whether IPv6 is to be re-written or not (for example, failover-IP).

A new created IPv6 Is matched against the prefix, and must match. The same applies when you create a prefix – this must match the shortest IPv6 address.

Install or update ISPconfig 3.0.5

Change to the directory of ISPConfig

cd /usr/local/ispconfig

Back up the files that are changed by the patch

cp -p interface/lib/classes/ interface/lib/classes/

cp -p interface/web/admin/form/server_config.tform.php interface/web/admin form/server_config.tform.php.orig

cp -p interface/web/admin/form/server_ip.tform.php interface/web/admin/form/server_ip.tform.php.orig

cp -p interface/web/admin/lib/lang/en_server_config.lng interface/web/admin/lib/lang/en_server_config.lng.orig

cp -p interface/web/admin/lib/lang/en_server_ip.lng interface/web/admin/lib/lang/en_server_ip.lng.orig

cp -p interface/web/admin/templates/server_config_server_edit.htm interface/web/admin/templates/server_config_server_edit.htm.orig

cp -p interface/web/admin/templates/server_config_web_edit.htm interface/web/admin/templates/server_config_web_edit.htm.orig

cp -p server/plugins-available/ server/plugins-available/

Download the patch and apply.

patch -Np1 -i ispconfig305-rewritev6.patch

If everything worked correctly, the output looks like this:

patching file interface/lib/classes/
patching file interface/web/admin/form/server_config.tform.php
patching file interface/web/admin/form/server_ip.tform.php
patching file interface/web/admin/lib/lang/en_server_config.lng
patching file interface/web/admin/lib/lang/en_server_ip.lng
patching file interface/web/admin/templates/server_config_server_edit.htm
patching file interface/web/admin/templates/server_config_web_edit.htm
patching file server/plugins-available/

rewrite IPv4
Define the IPv4 for the server (mirror) in /usr/local/ispconfig/server/lib/


IPV4 will only be rewritten, if a local IPv4 is defined and you didn´t set * in ISPConfig for the IP-address.

As long as you created backup, a restore is possible. Just copy the .orig-files back.

Leave a comment

Your email address will not be published. Required fields are marked *

3 thoughts on “ISPConfig 3.0.5 – rewrite ip on mirror(s)

  • Rich James

    If you just want to update Apache (and use a later version of IS Config than this patch supports) then the following change is sufficient:

    vim /usr/local/ispconfig/server/plugins-available/

    Add the following 3 lines:

    if (isset($conf[‘ipv4_replace’]) && $conf[‘ipv4_replace’] “” && $data[‘new’][‘ip_address’] ‘*’) {
    $data[‘new’][‘ip_address’] = $conf[‘ipv4_replace’];

    before this line:

    $tmp_vhost_arr = array(‘ip_address’ => $data[‘new’][‘ip_address’], ‘ssl_enabled’ => 0, ‘port’ => 80);

    Then create the config: /usr/local/ispconfig/server/lib/

    • Florian Schaal Post author

      Be carefull when you apply this patch to newer versions as it overrides some new code. I don´t think that this patch is used very often so i just update my local apache-plugin and use a local config-file. However, this is already implemented (and maintained 😉 ) in the upcoming ispconfig 3.1