#!/usr/local/bin/php and Manuel Kasper . 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. */ $pgtitle = array("Services", "DNS forwarder"); require("guiconfig.inc"); $pconfig['enable'] = isset($config['dnsmasq']['enable']); $pconfig['regdhcp'] = isset($config['dnsmasq']['regdhcp']); $pconfig['allservers'] = isset($config['dnsmasq']['allservers']); $pconfig['strictorder'] = isset($config['dnsmasq']['strictorder']); $pconfig['stoprebind'] = isset($config['dnsmasq']['stoprebind']); if (!is_array($config['dnsmasq']['hosts'])) { $config['dnsmasq']['hosts'] = array(); } if (!is_array($config['dnsmasq']['domainoverrides'])) { $config['dnsmasq']['domainoverrides'] = array(); } hosts_sort(); domainoverrides_sort(); $a_hosts = &$config['dnsmasq']['hosts']; $a_domainOverrides = &$config['dnsmasq']['domainoverrides']; if ($_POST) { foreach ($_POST as $pn => $pv) { if (preg_match("/^del_(.+)_x$/", $pn, $matches)) { list($type,$id) = explode(":", $matches[1]); if ($type == 'host') { if ($a_hosts[$id]) { unset($a_hosts[$id]); write_config(); touch($d_dnsmasqdirty_path); header("Location: services_dnsmasq.php"); exit; } } elseif ($type == 'doverride') { if ($a_domainOverrides[$id]) { unset($a_domainOverrides[$id]); write_config(); touch($d_dnsmasqdirty_path); header("Location: services_dnsmasq.php"); exit; } } } } $pconfig = $_POST; $config['dnsmasq']['enable'] = ($_POST['enable']) ? true : false; $config['dnsmasq']['regdhcp'] = ($_POST['regdhcp']) ? true : false; $config['dnsmasq']['allservers'] = ($_POST['allservers']) ? true : false; $config['dnsmasq']['strictorder'] = ($_POST['strictorder']) ? true : false; $config['dnsmasq']['stoprebind'] = ($_POST['stoprebind']) ? true : false; write_config(); $retval = 0; if (!file_exists($d_sysrebootreqd_path)) { config_lock(); $retval = services_dnsmasq_configure(); config_unlock(); } $savemsg = get_std_save_message($retval); if ($retval == 0) { if (file_exists($d_dnsmasqdirty_path)) unlink($d_dnsmasqdirty_path); } } ?>

You must apply the changes in order for them to take effect.");?>

> Enable DNS forwarder
> Enable All Servers
By default, when more than one upstream server is available, it will send queries to just one server. Setting this flag forces all queries to all available servers. The reply from the server which answers first will be returned to the original requestor.
> Strict Order
By default, the DNS forwarder will send queries to any of the upstream servers it knows about and tries to favour servers that are known to be up. Setting this flag forces it to try each query with each server strictly in order.
> Block DNS Rebind attacks
If this option is set, the DNS forwarder will reject (and log) addresses from upstream nameservers which are in the private IP ranges. This blocks an attack where a browser behind a firewall is used to probe machines on the local network. If you use domain overrides, this may cause responses to be blocked if they resolve within private IP ranges.
> Register DHCP leases in DNS forwarder
If this option is set, then machines that specify their hostname when requesting a DHCP lease will be registered in the DNS forwarder, so that their name can be resolved. You should also set the domain in System: General setup to the proper value.

Note:
If the DNS forwarder is enabled, the DHCP service (if enabled) will automatically serve the LAN IP address as a DNS server to DHCP clients so they will use the forwarder. The DNS forwarder will use the DNS servers entered in System: General setup or those obtained via DHCP or PPP on WAN if the "Allow DNS server list to be overridden by DHCP/PPP on WAN"
is checked. If you don't use that option (or if you use a static IP address on WAN), you must manually specify at least one DNS server on the System: General setup page.

You may enter records that override the results from the forwarders below.

Host Domain IP Description
        edit host  
add host

Below you can override an entire domain by specifying an authoritative DNS server to be queried for that domain.

Domain IP Description