#!/usr/local/bin/php . All rights reserved. Includes code from m0n0wall which is: Copyright (C) 2003-2005 Manuel Kasper . All rights reserved. Includes code from pfSense which is: Copyright (C) 2004-2005 Scott Ullrich . All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require("guiconfig.inc"); if (!is_array($config['virtualip']['vip'])) { $config['virtualip']['vip'] = array(); } $a_vip = &$config['virtualip']['vip']; if (isset($_POST['id'])) $id = $_POST['id']; else $id = $_GET['id']; if (isset($id) && $a_vip[$id]) { $pconfig['mode'] = $a_vip[$id]['mode']; $pconfig['vhid'] = $a_vip[$id]['vhid']; $pconfig['advskew'] = $a_vip[$id]['advskew']; $pconfig['password'] = $a_vip[$id]['password']; $pconfig['range'] = $a_vip[$id]['range']; $pconfig['subnet'] = $a_vip[$id]['subnet']; $pconfig['subnet_bits'] = $a_vip[$id]['subnet_bits']; $pconfig['descr'] = $a_vip[$id]['descr']; $pconfig['type'] = $a_vip[$id]['type']; $pconfig['interface'] = $a_vip[$id]['interface']; } if ($_POST) { unset($input_errors); $pconfig = $_POST; /* input validation */ $reqdfields = explode(" ", "mode"); $reqdfieldsn = explode(",", "Type"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); if (($_POST['subnet'] && !is_ipaddr($_POST['subnet']))) { $input_errors[] = "A valid IP address must be specified."; } if ($_POST['ipaddr'] == $config['interfaces']['wan']['ipaddr']) $input_errors[] = "The WAN IP address may not be used in a virtual entry."; if ($_POST['ipaddr'] == $config['interfaces']['lan']['ipaddr']) $input_errors[] = "The LAN IP address may not be used in a virtual entry."; /* check for overlaps with other virtual IP */ foreach ($a_vip as $vipent) { if (isset($id) && ($a_vip[$id]) && ($a_vip[$id] === $vipent)) continue; if (isset($_POST['subnet']) && $_POST['subnet'] == $vipent['subnet']) { $input_errors[] = "There is already a virtual IP entry for the specified IP address."; break; } } /* check for overlaps with 1:1 NAT */ if (is_array($config['nat']['onetoone'])) { foreach ($config['nat']['onetoone'] as $natent) { if (check_subnets_overlap($_POST['ipaddr'], 32, $natent['external'], $natent['subnet'])) { $input_errors[] = "A 1:1 NAT mapping overlaps with the specified IP address."; break; } } } if (!$input_errors) { $vipent = array(); $vipent['mode'] = $_POST['mode']; $vipent['interface'] = $_POST['interface']; /* ProxyARP specific fields */ if ($_POST['mode'] === "proxyarp") { if ($_POST['type'] == "range") { $vipent['range']['from'] = $_POST['range_from']; $vipent['range']['to'] = $_POST['range_to']; } } /* CARP specific fields */ if ($_POST['mode'] === "carp") { $vipent['vhid'] = $_POST['vhid']; $vipent['advskew'] = $_POST['advskew']; $vipent['password'] = $_POST['password']; } /* Common fields */ $vipent['descr'] = $_POST['descr']; if (isset($_POST['type'])) $vipent['type'] = $_POST['type']; else $vipent['type'] = "single"; if ($vipent['type'] == "single" || $vipent['type'] == "network") { if (!isset($_POST['subnet_bits'])) { $vipent['subnet_bits'] = "32"; } else { $vipent['subnet_bits'] = $_POST['subnet_bits']; } $vipent['subnet'] = $_POST['subnet']; } if (isset($id) && $a_vip[$id]) { /* modify all virtual IP rules with this address */ for ($i = 0; isset($config['nat']['rule'][$i]); $i++) { if ($config['nat']['rule'][$i]['external-address'] == $a_vip[$id]['subnet']) $config['nat']['rule'][$i]['external-address'] = $vipent['subnet']; } $a_vip[$id] = $vipent; } else $a_vip[] = $vipent; touch($d_vipconfdirty_path); /* setup carp interfaces */ interfaces_carp_configure(); write_config(); header("Location: firewall_virtual_ip.php"); exit; } } $pgtitle = "Firewall: Virtual IP Address: Edit"; include("head.inc"); ?>

Type > Proxy ARP > CARP > Other
Interface
IP Address(es)
Type:  
Address:   /
Range:   -
Virtual IP Password
Enter the VHID group password.
VHID Group
Enter the VHID group that the machines will share
Advertising Frequency
The frequency that this machine will advertise. 0 = master. Anything above 0 designates a backup.
Description
You may enter a description here for your reference (not parsed).