ISPConfig rc2 – rewrite ip on mirror(s)


As i described here, i change on a mirror the ipv6 according to the relevant subnet in the vhost-files. I added a rewrite for IPv4 and show you how to use this with the current RC.

Use this only with ISPConfig-3.0.5-rc2
For ISPConfig-3.0.5-rc2 see my post here.

In /usr/local/ispconfig/server/plugins-available/apache2_plugin.inc.php replace line 1333 – 1343 with:

if (isset($conf['ipv6_subnet']) && $conf['ipv6_subnet'] <> '') {
  $explode_v6prefix=explode(':',$conf['ipv6_subnet']);
  $explode_v6=explode(':',$data['new']['ipv6_address']);
  for ( $i = 0; $i <= count($explode_v6prefix)-3; $i++ ) {     $explode_v6[$i] = $explode_v6prefix[$i];} $data['new']     ['ipv6_address'] = implode(':',$explode_v6);   } }

The individual v6-subnet is added to /usr/local/ispconfig/server/lib/config.inc.local.php:
<?php
$conf['ipv6_subnet']='2a01:4f8:150:2262::';
?>

That´s all for ipv6. No we can rewrite ipv4.

In apache2_plugin.inc.php add after line 1309 (//* Add vhost for ipv4 IP:

if (isset($conf['ipv4_replace']) && $conf['ipv4_replace'] <> "" && $data['new']['ip_address'] <> '*') {
$data['new']['ip_address'] = $conf['ipv4_replace'];
}

and in /usr/local/ispconfig/server/lib/config.inc.local.php define the ipv4 for the server itself:
<?php
$conf['ipv4_replace']='78.46.84.243';
?>

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

Leave a comment

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