1 |
e9f147c8
|
Scott Ullrich
|
<?php
|
2 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
services_dhcp.php
|
5 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
e9f147c8
|
Scott Ullrich
|
|
7 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
8 |
|
|
All rights reserved.
|
9 |
e9f147c8
|
Scott Ullrich
|
|
10 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
11 |
|
|
modification, are permitted provided that the following conditions are met:
|
12 |
e9f147c8
|
Scott Ullrich
|
|
13 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
14 |
|
|
this list of conditions and the following disclaimer.
|
15 |
e9f147c8
|
Scott Ullrich
|
|
16 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
17 |
|
|
notice, this list of conditions and the following disclaimer in the
|
18 |
|
|
documentation and/or other materials provided with the distribution.
|
19 |
e9f147c8
|
Scott Ullrich
|
|
20 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
21 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
22 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
23 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
24 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
30 |
|
|
*/
|
31 |
1d333258
|
Scott Ullrich
|
/*
|
32 |
|
|
pfSense_BUILDER_BINARIES: /bin/rm
|
33 |
|
|
pfSense_MODULE: interfaces
|
34 |
|
|
*/
|
35 |
5b237745
|
Scott Ullrich
|
|
36 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
37 |
|
|
##|*IDENT=page-services-dhcpserver
|
38 |
|
|
##|*NAME=Services: DHCP server page
|
39 |
|
|
##|*DESCR=Allow access to the 'Services: DHCP server' page.
|
40 |
|
|
##|*MATCH=services_dhcp.php*
|
41 |
|
|
##|-PRIV
|
42 |
|
|
|
43 |
b7597d4e
|
Bill Marquette
|
require("guiconfig.inc");
|
44 |
5b237745
|
Scott Ullrich
|
|
45 |
2ee0410f
|
Scott Ullrich
|
if(!$g['services_dhcp_server_enable']) {
|
46 |
|
|
Header("Location: /");
|
47 |
|
|
exit;
|
48 |
|
|
}
|
49 |
|
|
|
50 |
c2ffc6c1
|
jim-p
|
/* This function will remove entries from dhcpd.leases that would otherwise
|
51 |
|
|
* overlap with static DHCP reservations. If we don't clean these out,
|
52 |
|
|
* then DHCP will print a warning in the logs about a duplicate lease
|
53 |
|
|
*/
|
54 |
|
|
function dhcp_clean_leases() {
|
55 |
|
|
global $g, $config;
|
56 |
|
|
$leasesfile = "{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases";
|
57 |
69ec9ecf
|
jim-p
|
if (!file_exists($leasesfile))
|
58 |
|
|
return;
|
59 |
c2ffc6c1
|
jim-p
|
/* Build list of static MACs */
|
60 |
|
|
$staticmacs = array();
|
61 |
|
|
foreach($config['interfaces'] as $ifname => $ifarr)
|
62 |
|
|
if (is_array($config['dhcpd'][$ifname]['staticmap']))
|
63 |
|
|
foreach($config['dhcpd'][$ifname]['staticmap'] as $static)
|
64 |
|
|
$staticmacs[] = $static['mac'];
|
65 |
|
|
/* Read existing leases */
|
66 |
|
|
$leases_contents = explode("\n", file_get_contents($leasesfile));
|
67 |
|
|
$newleases_contents = array();
|
68 |
|
|
$i=0;
|
69 |
|
|
while ($i < count($leases_contents)) {
|
70 |
|
|
/* Find a lease definition */
|
71 |
|
|
if (substr($leases_contents[$i], 0, 6) == "lease ") {
|
72 |
|
|
$templease = array();
|
73 |
|
|
$thismac = "";
|
74 |
|
|
/* Read to the end of the lease declaration */
|
75 |
|
|
do {
|
76 |
|
|
if (substr($leases_contents[$i], 0, 20) == " hardware ethernet ")
|
77 |
|
|
$thismac = substr($leases_contents[$i], 20, 17);
|
78 |
|
|
$templease[] = $leases_contents[$i];
|
79 |
|
|
$i++;
|
80 |
|
|
} while ($leases_contents[$i-1] != "}");
|
81 |
|
|
/* Check for a matching MAC address and if not present, keep it. */
|
82 |
|
|
if (! in_array($thismac, $staticmacs))
|
83 |
|
|
$newleases_contents = array_merge($newleases_contents, $templease);
|
84 |
|
|
} else {
|
85 |
|
|
/* It's a line we want to keep, copy it over. */
|
86 |
|
|
$newleases_contents[] = $leases_contents[$i];
|
87 |
|
|
$i++;
|
88 |
|
|
}
|
89 |
|
|
}
|
90 |
|
|
/* Write out the new leases file */
|
91 |
|
|
$fd = fopen($leasesfile, 'w');
|
92 |
|
|
fwrite($fd, implode("\n", $newleases_contents));
|
93 |
|
|
fclose($fd);
|
94 |
|
|
}
|
95 |
|
|
|
96 |
5b237745
|
Scott Ullrich
|
$if = $_GET['if'];
|
97 |
|
|
if ($_POST['if'])
|
98 |
|
|
$if = $_POST['if'];
|
99 |
e9f147c8
|
Scott Ullrich
|
|
100 |
11bc553c
|
Scott Ullrich
|
/* if OLSRD is enabled, allow WAN to house DHCP. */
|
101 |
a3b466b5
|
Scott Ullrich
|
if($config['installedpackages']['olsrd']) {
|
102 |
|
|
foreach($config['installedpackages']['olsrd']['config'] as $olsrd) {
|
103 |
bc15a1b9
|
Scott Ullrich
|
if($olsrd['enable']) {
|
104 |
48ab0cd2
|
Scott Ullrich
|
$is_olsr_enabled = true;
|
105 |
a3b466b5
|
Scott Ullrich
|
break;
|
106 |
|
|
}
|
107 |
|
|
}
|
108 |
11bc553c
|
Scott Ullrich
|
}
|
109 |
|
|
|
110 |
934240ef
|
Ermal Luçi
|
if (!$_GET['if'])
|
111 |
|
|
$savemsg = "<b>The DHCP Server can only be enabled on interfaces configured with static IP addresses.<p> The interfaces not configured with static ip will not be shown.</p></b>";
|
112 |
5b237745
|
Scott Ullrich
|
|
113 |
934240ef
|
Ermal Luçi
|
$iflist = get_configured_interface_with_descr();
|
114 |
5b237745
|
Scott Ullrich
|
|
115 |
1c451b06
|
Scott Ullrich
|
/* set the starting interface */
|
116 |
0a2c6a5b
|
Scott Ullrich
|
if($config['interfaces']['lan']) {
|
117 |
1c451b06
|
Scott Ullrich
|
if (!$if || !isset($iflist[$if]))
|
118 |
|
|
$if = "lan";
|
119 |
89019922
|
Ermal Luçi
|
} else
|
120 |
1c451b06
|
Scott Ullrich
|
$if = "wan";
|
121 |
0a2c6a5b
|
Scott Ullrich
|
|
122 |
89019922
|
Ermal Luçi
|
if (is_array($config['dhcpd'][$if])){
|
123 |
|
|
if (is_array($config['dhcpd'][$if]['range'])) {
|
124 |
|
|
$pconfig['range_from'] = $config['dhcpd'][$if]['range']['from'];
|
125 |
|
|
$pconfig['range_to'] = $config['dhcpd'][$if]['range']['to'];
|
126 |
|
|
}
|
127 |
|
|
$pconfig['deftime'] = $config['dhcpd'][$if]['defaultleasetime'];
|
128 |
|
|
$pconfig['maxtime'] = $config['dhcpd'][$if]['maxleasetime'];
|
129 |
|
|
$pconfig['gateway'] = $config['dhcpd'][$if]['gateway'];
|
130 |
|
|
$pconfig['domain'] = $config['dhcpd'][$if]['domain'];
|
131 |
|
|
$pconfig['domainsearchlist'] = $config['dhcpd'][$if]['domainsearchlist'];
|
132 |
|
|
list($pconfig['wins1'],$pconfig['wins2']) = $config['dhcpd'][$if]['winsserver'];
|
133 |
|
|
list($pconfig['dns1'],$pconfig['dns2']) = $config['dhcpd'][$if]['dnsserver'];
|
134 |
|
|
$pconfig['enable'] = isset($config['dhcpd'][$if]['enable']);
|
135 |
|
|
$pconfig['denyunknown'] = isset($config['dhcpd'][$if]['denyunknown']);
|
136 |
|
|
$pconfig['staticarp'] = isset($config['dhcpd'][$if]['staticarp']);
|
137 |
|
|
$pconfig['ddnsdomain'] = $config['dhcpd'][$if]['ddnsdomain'];
|
138 |
|
|
$pconfig['ddnsupdate'] = isset($config['dhcpd'][$if]['ddnsupdate']);
|
139 |
|
|
list($pconfig['ntp1'],$pconfig['ntp2']) = $config['dhcpd'][$if]['ntpserver'];
|
140 |
|
|
$pconfig['tftp'] = $config['dhcpd'][$if]['tftp'];
|
141 |
|
|
$pconfig['ldap'] = $config['dhcpd'][$if]['ldap'];
|
142 |
|
|
$pconfig['netboot'] = isset($config['dhcpd'][$if]['netboot']);
|
143 |
|
|
$pconfig['nextserver'] = $config['dhcpd'][$if]['next-server'];
|
144 |
|
|
$pconfig['filename'] = $config['dhcpd'][$if]['filename'];
|
145 |
|
|
$pconfig['rootpath'] = $config['dhcpd'][$if]['rootpath'];
|
146 |
|
|
$pconfig['failover_peerip'] = $config['dhcpd'][$if]['failover_peerip'];
|
147 |
|
|
$pconfig['netmask'] = $config['dhcpd'][$if]['netmask'];
|
148 |
518030b3
|
Scott Ullrich
|
$pconfig['numberoptions'] = $config['dhcpd'][$if]['numberoptions'];
|
149 |
89019922
|
Ermal Luçi
|
if (!is_array($config['dhcpd'][$if]['staticmap']))
|
150 |
|
|
$config['dhcpd'][$if]['staticmap'] = array();
|
151 |
|
|
$a_maps = &$config['dhcpd'][$if]['staticmap'];
|
152 |
|
|
}
|
153 |
31c59d0d
|
Scott Ullrich
|
|
154 |
a55e9c70
|
Ermal Lu?i
|
$ifcfgip = get_interface_ip($if);
|
155 |
|
|
$ifcfgsn = get_interface_subnet($if);
|
156 |
5b237745
|
Scott Ullrich
|
|
157 |
3d7b7757
|
Chris Buechler
|
|
158 |
|
|
/* set the enabled flag which will tell us if DHCP relay is enabled
|
159 |
|
|
* on any interface. We will use this to disable DHCP server since
|
160 |
|
|
* the two are not compatible with each other.
|
161 |
|
|
*/
|
162 |
|
|
|
163 |
|
|
$dhcrelay_enabled = false;
|
164 |
|
|
$dhcrelaycfg = $config['dhcrelay'];
|
165 |
|
|
|
166 |
|
|
if(is_array($dhcrelaycfg)) {
|
167 |
|
|
foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) {
|
168 |
|
|
if (isset($dhcrelayifconf['enable']) &&
|
169 |
|
|
(($dhcrelayif == "lan") ||
|
170 |
|
|
(isset($config['interfaces'][$dhcrelayif]['enable']) &&
|
171 |
7ec05d27
|
Ermal Luçi
|
$config['interfaces'][$dhcrelayif]['if'] && (!link_interface_to_bridge($dhcrelayif)))))
|
172 |
3d7b7757
|
Chris Buechler
|
$dhcrelay_enabled = true;
|
173 |
|
|
}
|
174 |
|
|
}
|
175 |
|
|
|
176 |
0ea7462d
|
Bill Marquette
|
function is_inrange($test, $start, $end) {
|
177 |
dd5b2ec6
|
Bill Marquette
|
if ( (ip2long($test) < ip2long($end)) && (ip2long($test) > ip2long($start)) )
|
178 |
0ea7462d
|
Bill Marquette
|
return true;
|
179 |
|
|
else
|
180 |
|
|
return false;
|
181 |
|
|
}
|
182 |
b7597d4e
|
Bill Marquette
|
|
183 |
5b237745
|
Scott Ullrich
|
if ($_POST) {
|
184 |
|
|
|
185 |
|
|
unset($input_errors);
|
186 |
b7597d4e
|
Bill Marquette
|
|
187 |
5b237745
|
Scott Ullrich
|
$pconfig = $_POST;
|
188 |
|
|
|
189 |
|
|
/* input validation */
|
190 |
|
|
if ($_POST['enable']) {
|
191 |
|
|
$reqdfields = explode(" ", "range_from range_to");
|
192 |
|
|
$reqdfieldsn = explode(",", "Range begin,Range end");
|
193 |
e9f147c8
|
Scott Ullrich
|
|
194 |
5b237745
|
Scott Ullrich
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
195 |
e2bce342
|
Scott Ullrich
|
|
196 |
5b237745
|
Scott Ullrich
|
if (($_POST['range_from'] && !is_ipaddr($_POST['range_from']))) {
|
197 |
|
|
$input_errors[] = "A valid range must be specified.";
|
198 |
|
|
}
|
199 |
|
|
if (($_POST['range_to'] && !is_ipaddr($_POST['range_to']))) {
|
200 |
|
|
$input_errors[] = "A valid range must be specified.";
|
201 |
|
|
}
|
202 |
6a01ea44
|
Bill Marquette
|
if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
|
203 |
f9261419
|
Bill Marquette
|
$input_errors[] = "A valid IP address must be specified for the gateway.";
|
204 |
6a01ea44
|
Bill Marquette
|
}
|
205 |
5b237745
|
Scott Ullrich
|
if (($_POST['wins1'] && !is_ipaddr($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddr($_POST['wins2']))) {
|
206 |
4cab31d0
|
Scott Ullrich
|
$input_errors[] = "A valid IP address must be specified for the primary/secondary WINS servers.";
|
207 |
|
|
}
|
208 |
|
|
if (($_POST['dns1'] && !is_ipaddr($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddr($_POST['dns2']))) {
|
209 |
|
|
$input_errors[] = "A valid IP address must be specified for the primary/secondary DNS servers.";
|
210 |
5b237745
|
Scott Ullrich
|
}
|
211 |
|
|
if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60))) {
|
212 |
|
|
$input_errors[] = "The default lease time must be at least 60 seconds.";
|
213 |
|
|
}
|
214 |
|
|
if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime']))) {
|
215 |
|
|
$input_errors[] = "The maximum lease time must be at least 60 seconds and higher than the default lease time.";
|
216 |
|
|
}
|
217 |
4e9cd828
|
Seth Mos
|
if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain']))) {
|
218 |
|
|
$input_errors[] = "A valid domain name must be specified for the dynamic DNS registration.";
|
219 |
|
|
}
|
220 |
ad171999
|
Seth Mos
|
if (($_POST['ntp1'] && !is_ipaddr($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddr($_POST['ntp2']))) {
|
221 |
|
|
$input_errors[] = "A valid IP address must be specified for the primary/secondary NTP servers.";
|
222 |
|
|
}
|
223 |
ee1b024e
|
Martin Fuchs
|
if (($_POST['domain'] && !is_domain($_POST['domain']))) {
|
224 |
|
|
$input_errors[] = "A valid domain name must be specified for the DNS domain.";
|
225 |
|
|
}
|
226 |
|
|
if (($_POST['tftp'] && !is_ipaddr($_POST['tftp']))) {
|
227 |
|
|
$input_errors[] = "A valid IP address must be specified for the tftp server.";
|
228 |
53f926df
|
Martin Fuchs
|
}
|
229 |
4e9cd828
|
Seth Mos
|
if (($_POST['nextserver'] && !is_ipaddr($_POST['nextserver']))) {
|
230 |
|
|
$input_errors[] = "A valid IP address must be specified for the network boot server.";
|
231 |
|
|
}
|
232 |
e9f147c8
|
Scott Ullrich
|
|
233 |
5b237745
|
Scott Ullrich
|
if (!$input_errors) {
|
234 |
|
|
/* make sure the range lies within the current subnet */
|
235 |
a55e9c70
|
Ermal Lu?i
|
$subnet_start = (ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn));
|
236 |
|
|
$subnet_end = (ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn)));
|
237 |
e9f147c8
|
Scott Ullrich
|
|
238 |
5b237745
|
Scott Ullrich
|
if ((ip2long($_POST['range_from']) < $subnet_start) || (ip2long($_POST['range_from']) > $subnet_end) ||
|
239 |
|
|
(ip2long($_POST['range_to']) < $subnet_start) || (ip2long($_POST['range_to']) > $subnet_end)) {
|
240 |
e9f147c8
|
Scott Ullrich
|
$input_errors[] = "The specified range lies outside of the current subnet.";
|
241 |
5b237745
|
Scott Ullrich
|
}
|
242 |
e9f147c8
|
Scott Ullrich
|
|
243 |
5b237745
|
Scott Ullrich
|
if (ip2long($_POST['range_from']) > ip2long($_POST['range_to']))
|
244 |
|
|
$input_errors[] = "The range is invalid (first element higher than second element).";
|
245 |
e9f147c8
|
Scott Ullrich
|
|
246 |
5b237745
|
Scott Ullrich
|
/* make sure that the DHCP Relay isn't enabled on this interface */
|
247 |
|
|
if (isset($config['dhcrelay'][$if]['enable']))
|
248 |
|
|
$input_errors[] = "You must disable the DHCP relay on the {$iflist[$if]} interface before enabling the DHCP server.";
|
249 |
|
|
}
|
250 |
|
|
}
|
251 |
|
|
|
252 |
|
|
if (!$input_errors) {
|
253 |
89019922
|
Ermal Luçi
|
if (!is_array($config['dhcpd'][$if]))
|
254 |
|
|
$config['dhcpd'][$if] = array();
|
255 |
|
|
if (!is_array($config['dhcpd'][$if]['range']))
|
256 |
|
|
$config['dhcpd'][$if]['range'] = array();
|
257 |
|
|
|
258 |
5b237745
|
Scott Ullrich
|
$config['dhcpd'][$if]['range']['from'] = $_POST['range_from'];
|
259 |
|
|
$config['dhcpd'][$if]['range']['to'] = $_POST['range_to'];
|
260 |
|
|
$config['dhcpd'][$if]['defaultleasetime'] = $_POST['deftime'];
|
261 |
|
|
$config['dhcpd'][$if]['maxleasetime'] = $_POST['maxtime'];
|
262 |
48ab0cd2
|
Scott Ullrich
|
$config['dhcpd'][$if]['netmask'] = $_POST['netmask'];
|
263 |
d378c59b
|
Scott Ullrich
|
$previous = $config['dhcpd'][$if]['failover_peerip'];
|
264 |
1d333258
|
Scott Ullrich
|
if($previous <> $_POST['failover_peerip'])
|
265 |
|
|
mwexec("/bin/rm -rf /var/dhcpd/var/db/*");
|
266 |
|
|
|
267 |
ea166a33
|
Scott Ullrich
|
$config['dhcpd'][$if]['failover_peerip'] = $_POST['failover_peerip'];
|
268 |
e9f147c8
|
Scott Ullrich
|
|
269 |
5b237745
|
Scott Ullrich
|
unset($config['dhcpd'][$if]['winsserver']);
|
270 |
|
|
if ($_POST['wins1'])
|
271 |
|
|
$config['dhcpd'][$if]['winsserver'][] = $_POST['wins1'];
|
272 |
|
|
if ($_POST['wins2'])
|
273 |
|
|
$config['dhcpd'][$if]['winsserver'][] = $_POST['wins2'];
|
274 |
4cab31d0
|
Scott Ullrich
|
|
275 |
94a9cf1a
|
Scott Ullrich
|
unset($config['dhcpd'][$if]['dnsserver']);
|
276 |
e9f147c8
|
Scott Ullrich
|
if ($_POST['dns1'])
|
277 |
06d754d4
|
Scott Ullrich
|
$config['dhcpd'][$if]['dnsserver'][] = $_POST['dns1'];
|
278 |
e9f147c8
|
Scott Ullrich
|
if ($_POST['dns2'])
|
279 |
06d754d4
|
Scott Ullrich
|
$config['dhcpd'][$if]['dnsserver'][] = $_POST['dns2'];
|
280 |
e9f147c8
|
Scott Ullrich
|
|
281 |
f9261419
|
Bill Marquette
|
$config['dhcpd'][$if]['gateway'] = $_POST['gateway'];
|
282 |
1ebf937f
|
Martin Fuchs
|
$config['dhcpd'][$if]['domain'] = $_POST['domain'];
|
283 |
9be23653
|
Martin Fuchs
|
$config['dhcpd'][$if]['domainsearchlist'] = $_POST['domainsearchlist'];
|
284 |
6a01ea44
|
Bill Marquette
|
$config['dhcpd'][$if]['denyunknown'] = ($_POST['denyunknown']) ? true : false;
|
285 |
|
|
$config['dhcpd'][$if]['enable'] = ($_POST['enable']) ? true : false;
|
286 |
|
|
$config['dhcpd'][$if]['staticarp'] = ($_POST['staticarp']) ? true : false;
|
287 |
4e9cd828
|
Seth Mos
|
$config['dhcpd'][$if]['ddnsdomain'] = $_POST['ddnsdomain'];
|
288 |
|
|
$config['dhcpd'][$if]['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false;
|
289 |
ad171999
|
Seth Mos
|
|
290 |
|
|
unset($config['dhcpd'][$if]['ntpserver']);
|
291 |
|
|
if ($_POST['ntp1'])
|
292 |
|
|
$config['dhcpd'][$if]['ntpserver'][] = $_POST['ntp1'];
|
293 |
|
|
if ($_POST['ntp2'])
|
294 |
|
|
$config['dhcpd'][$if]['ntpserver'][] = $_POST['ntp2'];
|
295 |
|
|
|
296 |
6c23757b
|
Martin Fuchs
|
$config['dhcpd'][$if]['tftp'] = $_POST['tftp'];
|
297 |
|
|
$config['dhcpd'][$if]['ldap'] = $_POST['ldap'];
|
298 |
4e9cd828
|
Seth Mos
|
$config['dhcpd'][$if]['netboot'] = ($_POST['netboot']) ? true : false;
|
299 |
|
|
$config['dhcpd'][$if]['next-server'] = $_POST['nextserver'];
|
300 |
|
|
$config['dhcpd'][$if]['filename'] = $_POST['filename'];
|
301 |
ee1b024e
|
Martin Fuchs
|
$config['dhcpd'][$if]['rootpath'] = $_POST['rootpath'];
|
302 |
9c748b70
|
Scott Ullrich
|
|
303 |
d72b4114
|
Scott Ullrich
|
// Handle the custom options rowhelper
|
304 |
518030b3
|
Scott Ullrich
|
$numbervalue = array();
|
305 |
|
|
unset($config['dhcpd'][$if]['numberoptions']['item']);
|
306 |
|
|
for($x=0; $x<isset($_POST["number{$x}"]); $x++) {
|
307 |
c7820b65
|
Scott Ullrich
|
if(is_int(intval($_POST["number{$x}"]))) {
|
308 |
990a271c
|
Scott Ullrich
|
$numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]);
|
309 |
|
|
$numbervalue['value'] = htmlspecialchars($_POST["value{$x}"]);
|
310 |
|
|
$config['dhcpd'][$if]['numberoptions']['item'][] = $numbervalue;
|
311 |
|
|
}
|
312 |
518030b3
|
Scott Ullrich
|
}
|
313 |
d72b4114
|
Scott Ullrich
|
|
314 |
|
|
// Reload the new pconfig variable that the forum uses.
|
315 |
518030b3
|
Scott Ullrich
|
$pconfig['numberoptions'] = $config['dhcpd'][$if]['numberoptions'];
|
316 |
|
|
|
317 |
5b237745
|
Scott Ullrich
|
write_config();
|
318 |
80933129
|
Bill Marquette
|
|
319 |
|
|
/* static arp configuration */
|
320 |
c5a0fd3c
|
Scott Ullrich
|
interfaces_staticarp_configure($if);
|
321 |
e9f147c8
|
Scott Ullrich
|
|
322 |
5b237745
|
Scott Ullrich
|
$retval = 0;
|
323 |
6a01ea44
|
Bill Marquette
|
$retvaldhcp = 0;
|
324 |
|
|
$retvaldns = 0;
|
325 |
c2ffc6c1
|
jim-p
|
/* Stop DHCP so we can cleanup leases */
|
326 |
|
|
killbyname("dhcpd");
|
327 |
|
|
dhcp_clean_leases();
|
328 |
6a01ea44
|
Bill Marquette
|
/* dnsmasq_configure calls dhcpd_configure */
|
329 |
|
|
/* no need to restart dhcpd twice */
|
330 |
|
|
if (isset($config['dnsmasq']['regdhcpstatic'])) {
|
331 |
|
|
$retvaldns = services_dnsmasq_configure();
|
332 |
|
|
if ($retvaldns == 0) {
|
333 |
a368a026
|
Ermal Lu?i
|
clear_subsystem_dirty('hosts');
|
334 |
|
|
clear_subsystem_dirty('staticmaps');
|
335 |
6a01ea44
|
Bill Marquette
|
}
|
336 |
|
|
} else {
|
337 |
|
|
$retvaldhcp = services_dhcpd_configure();
|
338 |
a368a026
|
Ermal Lu?i
|
if ($retvaldhcp == 0)
|
339 |
|
|
clear_subsystem_dirty('staticmaps');
|
340 |
6a01ea44
|
Bill Marquette
|
}
|
341 |
|
|
if($retvaldhcp == 1 || $retvaldns == 1)
|
342 |
|
|
$retval = 1;
|
343 |
5b237745
|
Scott Ullrich
|
$savemsg = get_std_save_message($retval);
|
344 |
|
|
}
|
345 |
|
|
}
|
346 |
|
|
|
347 |
|
|
if ($_GET['act'] == "del") {
|
348 |
|
|
if ($a_maps[$_GET['id']]) {
|
349 |
|
|
unset($a_maps[$_GET['id']]);
|
350 |
|
|
write_config();
|
351 |
6a01ea44
|
Bill Marquette
|
if(isset($config['dhcpd'][$if]['enable'])) {
|
352 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('staticmaps');
|
353 |
6a01ea44
|
Bill Marquette
|
if (isset($config['dnsmasq']['regdhcpstatic']))
|
354 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('hosts');
|
355 |
6a01ea44
|
Bill Marquette
|
}
|
356 |
5b237745
|
Scott Ullrich
|
header("Location: services_dhcp.php?if={$if}");
|
357 |
|
|
exit;
|
358 |
|
|
}
|
359 |
|
|
}
|
360 |
4df96eff
|
Scott Ullrich
|
|
361 |
d88c6a9f
|
Scott Ullrich
|
$pgtitle = array("Services","DHCP server");
|
362 |
4df96eff
|
Scott Ullrich
|
include("head.inc");
|
363 |
|
|
|
364 |
5b237745
|
Scott Ullrich
|
?>
|
365 |
4df96eff
|
Scott Ullrich
|
|
366 |
518030b3
|
Scott Ullrich
|
<script type="text/javascript" src="/javascript/row_helper.js">
|
367 |
|
|
</script>
|
368 |
4e9cd828
|
Seth Mos
|
|
369 |
518030b3
|
Scott Ullrich
|
<script type="text/javascript">
|
370 |
|
|
rowname[0] = "number";
|
371 |
|
|
rowtype[0] = "textbox";
|
372 |
4e10cf0a
|
Scott Ullrich
|
rowsize[0] = "10";
|
373 |
518030b3
|
Scott Ullrich
|
rowname[1] = "value";
|
374 |
|
|
rowtype[1] = "textbox";
|
375 |
4e10cf0a
|
Scott Ullrich
|
rowsize[1] = "55";
|
376 |
518030b3
|
Scott Ullrich
|
</script>
|
377 |
4e9cd828
|
Seth Mos
|
|
378 |
518030b3
|
Scott Ullrich
|
<script type="text/javascript" language="JavaScript">
|
379 |
|
|
function enable_change(enable_over) {
|
380 |
|
|
var endis;
|
381 |
|
|
endis = !(document.iform.enable.checked || enable_over);
|
382 |
|
|
document.iform.range_from.disabled = endis;
|
383 |
|
|
document.iform.range_to.disabled = endis;
|
384 |
|
|
document.iform.wins1.disabled = endis;
|
385 |
|
|
document.iform.wins2.disabled = endis;
|
386 |
|
|
document.iform.dns1.disabled = endis;
|
387 |
|
|
document.iform.dns2.disabled = endis;
|
388 |
|
|
document.iform.deftime.disabled = endis;
|
389 |
|
|
document.iform.maxtime.disabled = endis;
|
390 |
|
|
document.iform.gateway.disabled = endis;
|
391 |
|
|
document.iform.failover_peerip.disabled = endis;
|
392 |
|
|
document.iform.domain.disabled = endis;
|
393 |
|
|
document.iform.domainsearchlist.disabled = endis;
|
394 |
|
|
document.iform.staticarp.disabled = endis;
|
395 |
|
|
document.iform.ddnsdomain.disabled = endis;
|
396 |
|
|
document.iform.ddnsupdate.disabled = endis;
|
397 |
|
|
document.iform.ntp1.disabled = endis;
|
398 |
|
|
document.iform.ntp2.disabled = endis;
|
399 |
|
|
document.iform.tftp.disabled = endis;
|
400 |
|
|
document.iform.ldap.disabled = endis;
|
401 |
|
|
document.iform.netboot.disabled = endis;
|
402 |
|
|
document.iform.nextserver.disabled = endis;
|
403 |
|
|
document.iform.filename.disabled = endis;
|
404 |
|
|
document.iform.rootpath.disabled = endis;
|
405 |
|
|
document.iform.denyunknown.disabled = endis;
|
406 |
|
|
}
|
407 |
4e9cd828
|
Seth Mos
|
|
408 |
b1d132f5
|
Scott Ullrich
|
function show_shownumbervalue() {
|
409 |
|
|
document.getElementById("shownumbervaluebox").innerHTML='';
|
410 |
|
|
aodiv = document.getElementById('shownumbervalue');
|
411 |
|
|
aodiv.style.display = "block";
|
412 |
|
|
}
|
413 |
|
|
|
414 |
518030b3
|
Scott Ullrich
|
function show_ddns_config() {
|
415 |
|
|
document.getElementById("showddnsbox").innerHTML='';
|
416 |
|
|
aodiv = document.getElementById('showddns');
|
417 |
|
|
aodiv.style.display = "block";
|
418 |
|
|
}
|
419 |
ad171999
|
Seth Mos
|
|
420 |
518030b3
|
Scott Ullrich
|
function show_ntp_config() {
|
421 |
|
|
document.getElementById("showntpbox").innerHTML='';
|
422 |
|
|
aodiv = document.getElementById('showntp');
|
423 |
|
|
aodiv.style.display = "block";
|
424 |
|
|
}
|
425 |
6c23757b
|
Martin Fuchs
|
|
426 |
518030b3
|
Scott Ullrich
|
function show_tftp_config() {
|
427 |
|
|
document.getElementById("showtftpbox").innerHTML='';
|
428 |
|
|
aodiv = document.getElementById('showtftp');
|
429 |
|
|
aodiv.style.display = "block";
|
430 |
|
|
}
|
431 |
6c23757b
|
Martin Fuchs
|
|
432 |
518030b3
|
Scott Ullrich
|
function show_ldap_config() {
|
433 |
|
|
document.getElementById("showldapbox").innerHTML='';
|
434 |
|
|
aodiv = document.getElementById('showldap');
|
435 |
|
|
aodiv.style.display = "block";
|
436 |
|
|
}
|
437 |
4e9cd828
|
Seth Mos
|
|
438 |
518030b3
|
Scott Ullrich
|
function show_netboot_config() {
|
439 |
|
|
document.getElementById("shownetbootbox").innerHTML='';
|
440 |
|
|
aodiv = document.getElementById('shownetboot');
|
441 |
|
|
aodiv.style.display = "block";
|
442 |
|
|
}
|
443 |
5b237745
|
Scott Ullrich
|
</script>
|
444 |
|
|
|
445 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
446 |
b7597d4e
|
Bill Marquette
|
<?php include("fbegin.inc"); ?>
|
447 |
5b237745
|
Scott Ullrich
|
<form action="services_dhcp.php" method="post" name="iform" id="iform">
|
448 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
449 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
450 |
3d7b7757
|
Chris Buechler
|
<?php
|
451 |
|
|
if ($dhcrelay_enabled) {
|
452 |
|
|
echo "DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.";
|
453 |
|
|
include("fend.inc");
|
454 |
|
|
echo "</body>";
|
455 |
|
|
echo "</html>";
|
456 |
|
|
exit;
|
457 |
|
|
}
|
458 |
|
|
?>
|
459 |
a368a026
|
Ermal Lu?i
|
<?php if (is_subsystem_dirty('staticmaps')): ?><p>
|
460 |
5b237745
|
Scott Ullrich
|
<?php print_info_box_np("The static mapping configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
|
461 |
|
|
<?php endif; ?>
|
462 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
463 |
|
|
<tr><td>
|
464 |
f0cdf141
|
Scott Ullrich
|
<?php
|
465 |
|
|
/* active tabs */
|
466 |
|
|
$tab_array = array();
|
467 |
|
|
$tabscounter = 0;
|
468 |
|
|
$i = 0;
|
469 |
|
|
foreach ($iflist as $ifent => $ifname) {
|
470 |
934240ef
|
Ermal Luçi
|
$oc = $config['interfaces'][$ifent];
|
471 |
|
|
if (!is_ipaddr($oc['ipaddr']))
|
472 |
|
|
continue;
|
473 |
f0cdf141
|
Scott Ullrich
|
if ($ifent == $if)
|
474 |
|
|
$active = true;
|
475 |
|
|
else
|
476 |
|
|
$active = false;
|
477 |
|
|
$tab_array[] = array($ifname, $active, "services_dhcp.php?if={$ifent}");
|
478 |
934240ef
|
Ermal Luçi
|
$tabscounter++;
|
479 |
|
|
}
|
480 |
|
|
if ($tabscounter == 0) {
|
481 |
|
|
echo "</td></tr></table></form>";
|
482 |
|
|
include("fend.inc");
|
483 |
|
|
echo "</body>";
|
484 |
|
|
echo "</html>";
|
485 |
|
|
exit;
|
486 |
f0cdf141
|
Scott Ullrich
|
}
|
487 |
|
|
display_top_tabs($tab_array);
|
488 |
|
|
?>
|
489 |
5b237745
|
Scott Ullrich
|
</td></tr>
|
490 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
491 |
d732f186
|
Bill Marquette
|
<td>
|
492 |
|
|
<div id="mainarea">
|
493 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
|
494 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
495 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vtable"> </td>
|
496 |
|
|
<td width="78%" class="vtable">
|
497 |
518030b3
|
Scott Ullrich
|
<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
|
498 |
e9f147c8
|
Scott Ullrich
|
<strong>Enable DHCP server on
|
499 |
5b237745
|
Scott Ullrich
|
<?=htmlspecialchars($iflist[$if]);?>
|
500 |
|
|
interface</strong></td>
|
501 |
|
|
</tr>
|
502 |
|
|
<tr>
|
503 |
|
|
<td width="22%" valign="top" class="vtable"> </td>
|
504 |
|
|
<td width="78%" class="vtable">
|
505 |
518030b3
|
Scott Ullrich
|
<input name="denyunknown" id="denyunknown" type="checkbox" value="yes" <?php if ($pconfig['denyunknown']) echo "checked"; ?>>
|
506 |
5b237745
|
Scott Ullrich
|
<strong>Deny unknown clients</strong><br>
|
507 |
|
|
If this is checked, only the clients defined below will get DHCP leases from this server. </td>
|
508 |
|
|
</tr>
|
509 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
510 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncellreq">Subnet</td>
|
511 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
512 |
a55e9c70
|
Ermal Lu?i
|
<?=gen_subnet($ifcfgip, $ifcfgsn);?>
|
513 |
5b237745
|
Scott Ullrich
|
</td>
|
514 |
|
|
</tr>
|
515 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
516 |
|
|
<td width="22%" valign="top" class="vncellreq">Subnet
|
517 |
5b237745
|
Scott Ullrich
|
mask</td>
|
518 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
519 |
a55e9c70
|
Ermal Lu?i
|
<?=gen_subnet_mask($ifcfgsn);?>
|
520 |
5b237745
|
Scott Ullrich
|
</td>
|
521 |
|
|
</tr>
|
522 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
523 |
|
|
<td width="22%" valign="top" class="vncellreq">Available
|
524 |
5b237745
|
Scott Ullrich
|
range</td>
|
525 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
526 |
a55e9c70
|
Ermal Lu?i
|
<?=long2ip(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn));?>
|
527 |
e9f147c8
|
Scott Ullrich
|
-
|
528 |
a55e9c70
|
Ermal Lu?i
|
<?=long2ip(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))); ?>
|
529 |
5b237745
|
Scott Ullrich
|
</td>
|
530 |
|
|
</tr>
|
531 |
48ab0cd2
|
Scott Ullrich
|
<?php if($is_olsr_enabled): ?>
|
532 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
533 |
48ab0cd2
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncellreq">Subnet Mask</td>
|
534 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
535 |
b5c78501
|
Seth Mos
|
<select name="netmask" class="formselect" id="netmask">
|
536 |
48ab0cd2
|
Scott Ullrich
|
<?php
|
537 |
|
|
for ($i = 32; $i > 0; $i--) {
|
538 |
|
|
if($i <> 31) {
|
539 |
|
|
echo "<option value=\"{$i}\" ";
|
540 |
983c0b1f
|
Scott Ullrich
|
if ($i == $pconfig['netmask']) echo "selected";
|
541 |
48ab0cd2
|
Scott Ullrich
|
echo ">" . $i . "</option>";
|
542 |
|
|
}
|
543 |
|
|
}
|
544 |
|
|
?>
|
545 |
|
|
</select>
|
546 |
|
|
</td>
|
547 |
|
|
</tr>
|
548 |
e9f147c8
|
Scott Ullrich
|
<?php endif; ?>
|
549 |
|
|
<tr>
|
550 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncellreq">Range</td>
|
551 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
552 |
b5c78501
|
Seth Mos
|
<input name="range_from" type="text" class="formfld unknown" id="range_from" size="20" value="<?=htmlspecialchars($pconfig['range_from']);?>">
|
553 |
|
|
to <input name="range_to" type="text" class="formfld unknown" id="range_to" size="20" value="<?=htmlspecialchars($pconfig['range_to']);?>">
|
554 |
518030b3
|
Scott Ullrich
|
</td>
|
555 |
5b237745
|
Scott Ullrich
|
</tr>
|
556 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
557 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncell">WINS servers</td>
|
558 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
559 |
b5c78501
|
Seth Mos
|
<input name="wins1" type="text" class="formfld unknown" id="wins1" size="20" value="<?=htmlspecialchars($pconfig['wins1']);?>"><br>
|
560 |
|
|
<input name="wins2" type="text" class="formfld unknown" id="wins2" size="20" value="<?=htmlspecialchars($pconfig['wins2']);?>">
|
561 |
518030b3
|
Scott Ullrich
|
</td>
|
562 |
5b237745
|
Scott Ullrich
|
</tr>
|
563 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
564 |
4cab31d0
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncell">DNS servers</td>
|
565 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
566 |
b5c78501
|
Seth Mos
|
<input name="dns1" type="text" class="formfld unknown" id="dns1" size="20" value="<?=htmlspecialchars($pconfig['dns1']);?>"><br>
|
567 |
|
|
<input name="dns2" type="text" class="formfld unknown" id="dns2" size="20" value="<?=htmlspecialchars($pconfig['dns2']);?>"><br>
|
568 |
518030b3
|
Scott Ullrich
|
NOTE: leave blank to use the system default DNS servers - this interface's IP if DNS forwarder is enabled, otherwise the servers configured on the General page.
|
569 |
|
|
</td>
|
570 |
4cab31d0
|
Scott Ullrich
|
</tr>
|
571 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
572 |
b7597d4e
|
Bill Marquette
|
<td width="22%" valign="top" class="vncell">Gateway</td>
|
573 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
574 |
b5c78501
|
Seth Mos
|
<input name="gateway" type="text" class="formfld host" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"><br>
|
575 |
518030b3
|
Scott Ullrich
|
The default is to use the IP on this interface of the firewall as the gateway. Specify an alternate gateway here if this is not the correct gateway for your network.
|
576 |
|
|
</td>
|
577 |
1ebf937f
|
Martin Fuchs
|
</tr>
|
578 |
9be23653
|
Martin Fuchs
|
<tr>
|
579 |
1ebf937f
|
Martin Fuchs
|
<td width="22%" valign="top" class="vncell">Domain-Name</td>
|
580 |
|
|
<td width="78%" class="vtable">
|
581 |
b5c78501
|
Seth Mos
|
<input name="domain" type="text" class="formfld unknown" id="domain" size="20" value="<?=htmlspecialchars($pconfig['domain']);?>"><br>
|
582 |
518030b3
|
Scott Ullrich
|
The default is to use the domainname of the router as DNS-Search string that is served via DHCP. Specify an alternate DNS-Search string here.
|
583 |
|
|
</td>
|
584 |
2af4c579
|
Scott Ullrich
|
</tr>
|
585 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
586 |
9be23653
|
Martin Fuchs
|
<td width="22%" valign="top" class="vncell">Domain-Searchlist</td>
|
587 |
|
|
<td width="78%" class="vtable">
|
588 |
b5c78501
|
Seth Mos
|
<input name="domainsearchlist" type="text" class="formfld unknown" id="domainsearchlist" size="20" value="<?=htmlspecialchars($pconfig['domainsearchlist']);?>"><br>
|
589 |
518030b3
|
Scott Ullrich
|
DNS-Searchlist: the DHCP server can serve a list of domains to be searched.
|
590 |
|
|
</td>
|
591 |
9be23653
|
Martin Fuchs
|
</tr>
|
592 |
|
|
<tr>
|
593 |
|
|
<td width="22%" valign="top" class="vncell">Default lease time</td>
|
594 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
595 |
b5c78501
|
Seth Mos
|
<input name="deftime" type="text" class="formfld unknown" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>">
|
596 |
5b237745
|
Scott Ullrich
|
seconds<br>
|
597 |
e9f147c8
|
Scott Ullrich
|
This is used for clients that do not ask for a specific
|
598 |
5b237745
|
Scott Ullrich
|
expiration time.<br>
|
599 |
2af4c579
|
Scott Ullrich
|
The default is 7200 seconds.
|
600 |
518030b3
|
Scott Ullrich
|
</td>
|
601 |
5b237745
|
Scott Ullrich
|
</tr>
|
602 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
603 |
9be23653
|
Martin Fuchs
|
<td width="22%" valign="top" class="vncell">Maximum lease time</td>
|
604 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
605 |
b5c78501
|
Seth Mos
|
<input name="maxtime" type="text" class="formfld unknown" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>">
|
606 |
5b237745
|
Scott Ullrich
|
seconds<br>
|
607 |
e9f147c8
|
Scott Ullrich
|
This is the maximum lease time for clients that ask
|
608 |
5b237745
|
Scott Ullrich
|
for a specific expiration time.<br>
|
609 |
2af4c579
|
Scott Ullrich
|
The default is 86400 seconds.
|
610 |
518030b3
|
Scott Ullrich
|
</td>
|
611 |
5b237745
|
Scott Ullrich
|
</tr>
|
612 |
ea166a33
|
Scott Ullrich
|
<tr>
|
613 |
|
|
<td width="22%" valign="top" class="vncell">Failover peer IP:</td>
|
614 |
|
|
<td width="78%" class="vtable">
|
615 |
b5c78501
|
Seth Mos
|
<input name="failover_peerip" type="text" class="formfld host" id="failover_peerip" size="20" value="<?=htmlspecialchars($pconfig['failover_peerip']);?>"><br>
|
616 |
be586e5f
|
Scott Ullrich
|
Leave blank to disable. Enter the REAL address of the other machine. Machines must be using CARP.
|
617 |
ea166a33
|
Scott Ullrich
|
</td>
|
618 |
518030b3
|
Scott Ullrich
|
</tr>
|
619 |
|
|
<tr>
|
620 |
|
|
<td width="22%" valign="top" class="vncell">
|
621 |
|
|
Static ARP
|
622 |
|
|
</td>
|
623 |
|
|
<td width="78%" class="vtable">
|
624 |
|
|
<table>
|
625 |
|
|
<tr>
|
626 |
|
|
<td>
|
627 |
|
|
<input valign="middle" type="checkbox" value="yes" name="staticarp" id="staticarp" <?php if($pconfig['staticarp']) echo " checked"; ?>>
|
628 |
|
|
</td>
|
629 |
|
|
<td>
|
630 |
|
|
<b>Enable Static ARP entries</b>
|
631 |
|
|
</td>
|
632 |
|
|
</tr>
|
633 |
|
|
<tr>
|
634 |
|
|
<td>
|
635 |
|
|
|
636 |
|
|
</td>
|
637 |
|
|
<td>
|
638 |
|
|
<span class="red"><strong>Note:</strong></span> Only the machines listed below will be able to communicate with the firewall on this NIC.
|
639 |
|
|
</td>
|
640 |
|
|
</tr>
|
641 |
|
|
</table>
|
642 |
|
|
</td>
|
643 |
|
|
</tr>
|
644 |
|
|
<tr>
|
645 |
|
|
<td width="22%" valign="top" class="vncell">
|
646 |
|
|
Dynamic DNS
|
647 |
|
|
</td>
|
648 |
|
|
<td width="78%" class="vtable">
|
649 |
|
|
<div id="showddnsbox">
|
650 |
|
|
<input type="button" onClick="show_ddns_config()" value="Advanced"></input> - Show Dynamic DNS</a>
|
651 |
|
|
</div>
|
652 |
|
|
<div id="showddns" style="display:none">
|
653 |
|
|
<input valign="middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if($pconfig['ddnsupdate']) echo " checked"; ?>>
|
654 |
|
|
<b>Enable registration of DHCP client names in DNS.</b><br />
|
655 |
|
|
<p>
|
656 |
|
|
<input name="ddnsdomain" type="text" class="formfld unknown" id="ddnsdomain" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>"><br />
|
657 |
|
|
Note: Leave blank to disable dynamic DNS registration.<br />
|
658 |
|
|
Enter the dynamic DNS domain which will be used to register client names in the DNS server.
|
659 |
|
|
</div>
|
660 |
|
|
</td>
|
661 |
ea166a33
|
Scott Ullrich
|
</tr>
|
662 |
518030b3
|
Scott Ullrich
|
<tr>
|
663 |
|
|
<td width="22%" valign="top" class="vncell">NTP servers</td>
|
664 |
|
|
<td width="78%" class="vtable">
|
665 |
ad171999
|
Seth Mos
|
<div id="showntpbox">
|
666 |
|
|
<input type="button" onClick="show_ntp_config()" value="Advanced"></input> - Show NTP configuration</a>
|
667 |
|
|
</div>
|
668 |
|
|
<div id="showntp" style="display:none">
|
669 |
b5c78501
|
Seth Mos
|
<input name="ntp1" type="text" class="formfld unknown" id="ntp1" size="20" value="<?=htmlspecialchars($pconfig['ntp1']);?>"><br>
|
670 |
|
|
<input name="ntp2" type="text" class="formfld unknown" id="ntp2" size="20" value="<?=htmlspecialchars($pconfig['ntp2']);?>">
|
671 |
ad171999
|
Seth Mos
|
</div>
|
672 |
|
|
</td>
|
673 |
518030b3
|
Scott Ullrich
|
</tr>
|
674 |
|
|
<tr>
|
675 |
|
|
<td width="22%" valign="top" class="vncell">
|
676 |
|
|
TFTP server
|
677 |
|
|
</td>
|
678 |
|
|
<td width="78%" class="vtable">
|
679 |
6c23757b
|
Martin Fuchs
|
<div id="showtftpbox">
|
680 |
|
|
<input type="button" onClick="show_tftp_config()" value="Advanced"></input> - Show TFTP configuration</a>
|
681 |
|
|
</div>
|
682 |
|
|
<div id="showtftp" style="display:none">
|
683 |
b5c78501
|
Seth Mos
|
<input name="tftp" type="text" class="formfld unknown" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>"><br>
|
684 |
6c23757b
|
Martin Fuchs
|
Leave blank to disable. Enter a full hostname or IP for the TFTP server.
|
685 |
|
|
</div>
|
686 |
|
|
</td>
|
687 |
518030b3
|
Scott Ullrich
|
</tr>
|
688 |
|
|
<tr>
|
689 |
|
|
<td width="22%" valign="top" class="vncell">LDAP URI</td>
|
690 |
|
|
<td width="78%" class="vtable">
|
691 |
|
|
<div id="showldapbox">
|
692 |
|
|
<input type="button" onClick="show_ldap_config()" value="Advanced"></input> - Show LDAP configuration</a>
|
693 |
|
|
</div>
|
694 |
|
|
<div id="showldap" style="display:none">
|
695 |
|
|
<input name="ldap" type="text" class="formfld unknown" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>"><br>
|
696 |
|
|
Leave blank to disable. Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com
|
697 |
|
|
</div>
|
698 |
|
|
</td>
|
699 |
|
|
</tr>
|
700 |
|
|
<tr>
|
701 |
|
|
<td width="22%" valign="top" class="vncell">Enable Network booting</td>
|
702 |
|
|
<td width="78%" class="vtable">
|
703 |
|
|
<div id="shownetbootbox">
|
704 |
|
|
<input type="button" onClick="show_netboot_config()" value="Advanced"></input> - Show Network booting</a>
|
705 |
|
|
</div>
|
706 |
|
|
<div id="shownetboot" style="display:none">
|
707 |
|
|
<input valign="middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if($pconfig['netboot']) echo " checked"; ?>>
|
708 |
|
|
<b>Enables network booting.</b>
|
709 |
|
|
<p>
|
710 |
|
|
Enter the IP of the <b>next-server</b>
|
711 |
|
|
<input name="nextserver" type="text" class="formfld unknown" id="nextserver" size="20" value="<?=htmlspecialchars($pconfig['nextserver']);?>">
|
712 |
|
|
and the filename
|
713 |
|
|
<input name="filename" type="text" class="formfld unknown" id="filename" size="20" value="<?=htmlspecialchars($pconfig['filename']);?>"><br>
|
714 |
|
|
Note: You need both a filename and a boot server configured for this to work!
|
715 |
|
|
<p>
|
716 |
|
|
Enter the <b>root-path</b>-string
|
717 |
|
|
<input name="rootpath" type="text" class="formfld unknown" id="rootpath" size="90" value="<?=htmlspecialchars($pconfig['rootpath']);?>"><br>
|
718 |
|
|
Note: string-format: iscsi:(servername):(protocol):(port):(LUN):targetname
|
719 |
|
|
</div>
|
720 |
4e9cd828
|
Seth Mos
|
</td>
|
721 |
518030b3
|
Scott Ullrich
|
</tr>
|
722 |
|
|
<tr>
|
723 |
|
|
|
724 |
|
|
|
725 |
|
|
<td width="22%" valign="top" class="vncell">
|
726 |
|
|
Additional BOOTP/DHCP Options
|
727 |
|
|
</td>
|
728 |
|
|
<td width="78%" class="vtable">
|
729 |
b1d132f5
|
Scott Ullrich
|
<div id="shownumbervaluebox">
|
730 |
|
|
<input type="button" onClick="show_shownumbervalue()" value="Advanced"></input> - Show Additional BOOTP/DHCP Options</a>
|
731 |
|
|
</div>
|
732 |
|
|
<div id="shownumbervalue" style="display:none">
|
733 |
518030b3
|
Scott Ullrich
|
<table id="maintable">
|
734 |
|
|
<tbody>
|
735 |
|
|
<tr>
|
736 |
f2305ddb
|
Scott Ullrich
|
<td colspan="3">
|
737 |
2a778c44
|
Scott Ullrich
|
<div style="padding:5px; margin-top: 16px; margin-bottom: 16px; border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;" id="itemhelp">
|
738 |
|
|
Enter the DHCP option number and the value for each item you would like to include in the DHCP lease information. For a list of available options please visit this <a href="http://www.iana.org/assignments/bootp-dhcp-parameters/" target="_new">URL</a>.
|
739 |
|
|
</div>
|
740 |
518030b3
|
Scott Ullrich
|
</td>
|
741 |
|
|
</tr>
|
742 |
|
|
<tr>
|
743 |
|
|
<td><div id="onecolumn">Number</div></td>
|
744 |
|
|
<td><div id="twocolumn">Value</div></td>
|
745 |
|
|
</tr>
|
746 |
|
|
<?php $counter = 0; ?>
|
747 |
|
|
<?php
|
748 |
|
|
if($pconfig['numberoptions'])
|
749 |
|
|
foreach($pconfig['numberoptions']['item'] as $item):
|
750 |
|
|
?>
|
751 |
|
|
<?php
|
752 |
|
|
$number = $item['number'];
|
753 |
|
|
$value = $item['value'];
|
754 |
|
|
?>
|
755 |
|
|
<tr>
|
756 |
|
|
<td>
|
757 |
4e10cf0a
|
Scott Ullrich
|
<input autocomplete="off" name="number<?php echo $counter; ?>" type="text" class="formfld" id="number<?php echo $counter; ?>" size="10" value="<?=htmlspecialchars($number);?>" />
|
758 |
518030b3
|
Scott Ullrich
|
</td>
|
759 |
|
|
<td>
|
760 |
4e10cf0a
|
Scott Ullrich
|
<input autocomplete="off" name="value<?php echo $counter; ?>" type="text" class="formfld" id="value<?php echo $counter; ?>" size="55" value="<?=htmlspecialchars($value);?>" />
|
761 |
518030b3
|
Scott Ullrich
|
</td>
|
762 |
|
|
<td>
|
763 |
|
|
<input type="image" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" onclick="removeRow(this); return false;" value="Delete" />
|
764 |
|
|
</td>
|
765 |
|
|
</tr>
|
766 |
|
|
<?php $counter++; ?>
|
767 |
|
|
<?php endforeach; ?>
|
768 |
|
|
</tbody>
|
769 |
|
|
<tfoot>
|
770 |
|
|
</tfoot>
|
771 |
|
|
</table>
|
772 |
|
|
<a onclick="javascript:addRowTo('maintable', 'formfldalias'); return false;" href="#">
|
773 |
|
|
<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="add another entry" />
|
774 |
|
|
</a>
|
775 |
|
|
<script type="text/javascript">
|
776 |
|
|
field_counter_js = 2;
|
777 |
|
|
rows = 1;
|
778 |
|
|
totalrows = <?php echo $counter; ?>;
|
779 |
|
|
loaded = <?php echo $counter; ?>;
|
780 |
|
|
</script>
|
781 |
b1d132f5
|
Scott Ullrich
|
</div>
|
782 |
518030b3
|
Scott Ullrich
|
|
783 |
|
|
</td>
|
784 |
|
|
</tr>
|
785 |
|
|
<tr>
|
786 |
|
|
<td width="22%" valign="top"> </td>
|
787 |
|
|
<td width="78%">
|
788 |
|
|
<input name="if" type="hidden" value="<?=$if;?>">
|
789 |
|
|
<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
|
790 |
|
|
</td>
|
791 |
|
|
</tr>
|
792 |
|
|
<tr>
|
793 |
|
|
<td width="22%" valign="top"> </td>
|
794 |
|
|
<td width="78%"> <p><span class="vexpl"><span class="red"><strong>Note:<br>
|
795 |
|
|
</strong></span>The DNS servers entered in <a href="system.php">System:
|
796 |
|
|
General setup</a> (or the <a href="services_dnsmasq.php">DNS
|
797 |
|
|
forwarder</a>, if enabled) </span><span class="vexpl">will
|
798 |
|
|
be assigned to clients by the DHCP server.<br>
|
799 |
|
|
<br>
|
800 |
|
|
The DHCP lease table can be viewed on the <a href="diag_dhcp_leases.php">Status:
|
801 |
|
|
DHCP leases</a> page.<br>
|
802 |
|
|
</span></p>
|
803 |
|
|
</td>
|
804 |
|
|
</tr>
|
805 |
|
|
</table>
|
806 |
7128ed17
|
Scott Ullrich
|
<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
|
807 |
518030b3
|
Scott Ullrich
|
<tr>
|
808 |
|
|
<td width="25%" class="listhdrr">MAC address</td>
|
809 |
|
|
<td width="15%" class="listhdrr">IP address</td>
|
810 |
|
|
<td width="20%" class="listhdrr">Hostname</td>
|
811 |
|
|
<td width="30%" class="listhdr">Description</td>
|
812 |
|
|
<td width="10%" class="list">
|
813 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
814 |
|
|
<tr>
|
815 |
d415d821
|
Seth Mos
|
<td valign="middle" width="17"></td>
|
816 |
518030b3
|
Scott Ullrich
|
<td valign="middle"><a href="services_dhcp_edit.php?if=<?=$if;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
817 |
|
|
</tr>
|
818 |
|
|
</table>
|
819 |
|
|
</td>
|
820 |
2af4c579
|
Scott Ullrich
|
</tr>
|
821 |
6f5b2c3e
|
Scott Ullrich
|
<?php if(is_array($a_maps)): ?>
|
822 |
5b237745
|
Scott Ullrich
|
<?php $i = 0; foreach ($a_maps as $mapent): ?>
|
823 |
11c9bb94
|
Scott Ullrich
|
<?php if($mapent['mac'] <> "" or $mapent['ipaddr'] <> ""): ?>
|
824 |
5b237745
|
Scott Ullrich
|
<tr>
|
825 |
2d165eff
|
Bill Marquette
|
<td class="listlr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
|
826 |
5b237745
|
Scott Ullrich
|
<?=htmlspecialchars($mapent['mac']);?>
|
827 |
|
|
</td>
|
828 |
2d165eff
|
Bill Marquette
|
<td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
|
829 |
5b237745
|
Scott Ullrich
|
<?=htmlspecialchars($mapent['ipaddr']);?>
|
830 |
|
|
</td>
|
831 |
6a01ea44
|
Bill Marquette
|
<td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
|
832 |
|
|
<?=htmlspecialchars($mapent['hostname']);?>
|
833 |
|
|
</td>
|
834 |
2d165eff
|
Bill Marquette
|
<td class="listbg" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
|
835 |
d4da6249
|
Scott Ullrich
|
<?=htmlspecialchars($mapent['descr']);?>
|
836 |
5b237745
|
Scott Ullrich
|
</td>
|
837 |
75a70796
|
Bill Marquette
|
<td valign="middle" nowrap class="list">
|
838 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
839 |
|
|
<tr>
|
840 |
677c0869
|
Erik Kristensen
|
<td valign="middle"><a href="services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
|
841 |
|
|
<td valign="middle"><a href="services_dhcp.php?if=<?=$if;?>&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this mapping?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
|
842 |
75a70796
|
Bill Marquette
|
</tr>
|
843 |
|
|
</table>
|
844 |
|
|
</td>
|
845 |
|
|
</tr>
|
846 |
6f5b2c3e
|
Scott Ullrich
|
<?php endif; ?>
|
847 |
75a70796
|
Bill Marquette
|
<?php $i++; endforeach; ?>
|
848 |
6f5b2c3e
|
Scott Ullrich
|
<?php endif; ?>
|
849 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
850 |
6a01ea44
|
Bill Marquette
|
<td class="list" colspan="4"></td>
|
851 |
75a70796
|
Bill Marquette
|
<td class="list">
|
852 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
853 |
|
|
<tr>
|
854 |
d415d821
|
Seth Mos
|
<td valign="middle" width="17"></td>
|
855 |
677c0869
|
Erik Kristensen
|
<td valign="middle"><a href="services_dhcp_edit.php?if=<?=$if;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
856 |
75a70796
|
Bill Marquette
|
</tr>
|
857 |
|
|
</table>
|
858 |
|
|
</td>
|
859 |
|
|
</tr>
|
860 |
5b237745
|
Scott Ullrich
|
</table>
|
861 |
d732f186
|
Bill Marquette
|
</div>
|
862 |
5b237745
|
Scott Ullrich
|
</td>
|
863 |
|
|
</tr>
|
864 |
|
|
</table>
|
865 |
|
|
</form>
|
866 |
|
|
<script language="JavaScript">
|
867 |
|
|
<!--
|
868 |
|
|
enable_change(false);
|
869 |
|
|
//-->
|
870 |
|
|
</script>
|
871 |
b7597d4e
|
Bill Marquette
|
<?php include("fend.inc"); ?>
|
872 |
5b237745
|
Scott Ullrich
|
</body>
|
873 |
|
|
</html>
|