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 |
|
|
|
32 |
b7597d4e
|
Bill Marquette
|
require("guiconfig.inc");
|
33 |
5b237745
|
Scott Ullrich
|
|
34 |
|
|
$if = $_GET['if'];
|
35 |
|
|
if ($_POST['if'])
|
36 |
|
|
$if = $_POST['if'];
|
37 |
e9f147c8
|
Scott Ullrich
|
|
38 |
11bc553c
|
Scott Ullrich
|
/* if OLSRD is enabled, allow WAN to house DHCP. */
|
39 |
a3b466b5
|
Scott Ullrich
|
if($config['installedpackages']['olsrd']) {
|
40 |
|
|
foreach($config['installedpackages']['olsrd']['config'] as $olsrd) {
|
41 |
bc15a1b9
|
Scott Ullrich
|
if($olsrd['enable']) {
|
42 |
a3b466b5
|
Scott Ullrich
|
$iflist = array("lan" => "LAN", "wan" => "WAN");
|
43 |
48ab0cd2
|
Scott Ullrich
|
$is_olsr_enabled = true;
|
44 |
a3b466b5
|
Scott Ullrich
|
break;
|
45 |
|
|
}
|
46 |
|
|
}
|
47 |
11bc553c
|
Scott Ullrich
|
}
|
48 |
|
|
|
49 |
89240fb1
|
Scott Ullrich
|
if($config['interfaces']['lan']) {
|
50 |
afb16a46
|
Scott Ullrich
|
if(!$iflist)
|
51 |
|
|
$iflist = array("lan" => "LAN");
|
52 |
89240fb1
|
Scott Ullrich
|
} else {
|
53 |
49b94d3a
|
Chris Buechler
|
/* if WAN is configured for anything other than static
|
54 |
|
|
IP, do not allow DHCP server to be configured. */
|
55 |
|
|
if (!is_ipaddr($config['interfaces']['wan']['ipaddr']))
|
56 |
|
|
$singleif_nostaticip = true;
|
57 |
ca8869d9
|
Scott Ullrich
|
$iflist = array("wan" => strtoupper($g['wan_interface_name']));
|
58 |
89240fb1
|
Scott Ullrich
|
}
|
59 |
5b237745
|
Scott Ullrich
|
|
60 |
|
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
|
61 |
|
|
$oc = $config['interfaces']['opt' . $i];
|
62 |
e9f147c8
|
Scott Ullrich
|
|
63 |
5b237745
|
Scott Ullrich
|
if (isset($oc['enable']) && $oc['if'] && (!$oc['bridge'])) {
|
64 |
|
|
$iflist['opt' . $i] = $oc['descr'];
|
65 |
|
|
}
|
66 |
|
|
}
|
67 |
|
|
|
68 |
1c451b06
|
Scott Ullrich
|
/* set the starting interface */
|
69 |
0a2c6a5b
|
Scott Ullrich
|
if($config['interfaces']['lan']) {
|
70 |
1c451b06
|
Scott Ullrich
|
if (!$if || !isset($iflist[$if]))
|
71 |
|
|
$if = "lan";
|
72 |
0a2c6a5b
|
Scott Ullrich
|
} else {
|
73 |
1c451b06
|
Scott Ullrich
|
$if = "wan";
|
74 |
0a2c6a5b
|
Scott Ullrich
|
}
|
75 |
|
|
|
76 |
5b237745
|
Scott Ullrich
|
$pconfig['range_from'] = $config['dhcpd'][$if]['range']['from'];
|
77 |
|
|
$pconfig['range_to'] = $config['dhcpd'][$if]['range']['to'];
|
78 |
|
|
$pconfig['deftime'] = $config['dhcpd'][$if]['defaultleasetime'];
|
79 |
|
|
$pconfig['maxtime'] = $config['dhcpd'][$if]['maxleasetime'];
|
80 |
31c59d0d
|
Scott Ullrich
|
$pconfig['gateway'] = $config['dhcpd'][$if]['gateway'];
|
81 |
1ebf937f
|
Martin Fuchs
|
$pconfig['domain'] = $config['dhcpd'][$if]['domain'];
|
82 |
9be23653
|
Martin Fuchs
|
$pconfig['domainsearchlist'] = $config['dhcpd'][$if]['domainsearchlist'];
|
83 |
5b237745
|
Scott Ullrich
|
list($pconfig['wins1'],$pconfig['wins2']) = $config['dhcpd'][$if]['winsserver'];
|
84 |
06d754d4
|
Scott Ullrich
|
list($pconfig['dns1'],$pconfig['dns2']) = $config['dhcpd'][$if]['dnsserver'];
|
85 |
5b237745
|
Scott Ullrich
|
$pconfig['enable'] = isset($config['dhcpd'][$if]['enable']);
|
86 |
|
|
$pconfig['denyunknown'] = isset($config['dhcpd'][$if]['denyunknown']);
|
87 |
80933129
|
Bill Marquette
|
$pconfig['staticarp'] = isset($config['dhcpd'][$if]['staticarp']);
|
88 |
4e9cd828
|
Seth Mos
|
$pconfig['ddnsdomain'] = $config['dhcpd'][$if]['ddnsdomain'];
|
89 |
|
|
$pconfig['ddnsupdate'] = isset($config['dhcpd'][$if]['ddnsupdate']);
|
90 |
ad171999
|
Seth Mos
|
list($pconfig['ntp1'],$pconfig['ntp2']) = $config['dhcpd'][$if]['ntpserver'];
|
91 |
6c23757b
|
Martin Fuchs
|
$pconfig['tftp'] = $config['dhcpd'][$if]['tftp'];
|
92 |
|
|
$pconfig['ldap'] = $config['dhcpd'][$if]['ldap'];
|
93 |
4e9cd828
|
Seth Mos
|
$pconfig['netboot'] = isset($config['dhcpd'][$if]['netboot']);
|
94 |
|
|
$pconfig['nextserver'] = $config['dhcpd'][$if]['next-server'];
|
95 |
|
|
$pconfig['filename'] = $config['dhcpd'][$if]['filename'];
|
96 |
ee1b024e
|
Martin Fuchs
|
$pconfig['rootpath'] = $config['dhcpd'][$if]['rootpath'];
|
97 |
ea166a33
|
Scott Ullrich
|
$pconfig['failover_peerip'] = $config['dhcpd'][$if]['failover_peerip'];
|
98 |
48ab0cd2
|
Scott Ullrich
|
$pconfig['netmask'] = $config['dhcpd'][$if]['netmask'];
|
99 |
31c59d0d
|
Scott Ullrich
|
|
100 |
5b237745
|
Scott Ullrich
|
$ifcfg = $config['interfaces'][$if];
|
101 |
|
|
|
102 |
3d7b7757
|
Chris Buechler
|
|
103 |
|
|
/* set the enabled flag which will tell us if DHCP relay is enabled
|
104 |
|
|
* on any interface. We will use this to disable DHCP server since
|
105 |
|
|
* the two are not compatible with each other.
|
106 |
|
|
*/
|
107 |
|
|
|
108 |
|
|
$dhcrelay_enabled = false;
|
109 |
|
|
$dhcrelaycfg = $config['dhcrelay'];
|
110 |
|
|
|
111 |
|
|
if(is_array($dhcrelaycfg)) {
|
112 |
|
|
foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) {
|
113 |
|
|
if (isset($dhcrelayifconf['enable']) &&
|
114 |
|
|
(($dhcrelayif == "lan") ||
|
115 |
|
|
(isset($config['interfaces'][$dhcrelayif]['enable']) &&
|
116 |
|
|
$config['interfaces'][$dhcrelayif]['if'] && (!$config['interfaces'][$dhcrelayif]['bridge']))))
|
117 |
|
|
$dhcrelay_enabled = true;
|
118 |
|
|
}
|
119 |
|
|
}
|
120 |
|
|
|
121 |
602ebee3
|
Scott Ullrich
|
if (!is_array($config['dhcpd'][$if]['staticmap'])) {
|
122 |
|
|
$config['dhcpd'][$if]['staticmap'] = array();
|
123 |
|
|
}
|
124 |
|
|
staticmaps_sort($if);
|
125 |
5b237745
|
Scott Ullrich
|
$a_maps = &$config['dhcpd'][$if]['staticmap'];
|
126 |
6f5b2c3e
|
Scott Ullrich
|
|
127 |
0ea7462d
|
Bill Marquette
|
function is_inrange($test, $start, $end) {
|
128 |
dd5b2ec6
|
Bill Marquette
|
if ( (ip2long($test) < ip2long($end)) && (ip2long($test) > ip2long($start)) )
|
129 |
0ea7462d
|
Bill Marquette
|
return true;
|
130 |
|
|
else
|
131 |
|
|
return false;
|
132 |
|
|
}
|
133 |
b7597d4e
|
Bill Marquette
|
|
134 |
5b237745
|
Scott Ullrich
|
if ($_POST) {
|
135 |
|
|
|
136 |
|
|
unset($input_errors);
|
137 |
b7597d4e
|
Bill Marquette
|
|
138 |
5b237745
|
Scott Ullrich
|
$pconfig = $_POST;
|
139 |
|
|
|
140 |
|
|
/* input validation */
|
141 |
|
|
if ($_POST['enable']) {
|
142 |
|
|
$reqdfields = explode(" ", "range_from range_to");
|
143 |
|
|
$reqdfieldsn = explode(",", "Range begin,Range end");
|
144 |
e9f147c8
|
Scott Ullrich
|
|
145 |
5b237745
|
Scott Ullrich
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
146 |
e2bce342
|
Scott Ullrich
|
|
147 |
5b237745
|
Scott Ullrich
|
if (($_POST['range_from'] && !is_ipaddr($_POST['range_from']))) {
|
148 |
|
|
$input_errors[] = "A valid range must be specified.";
|
149 |
|
|
}
|
150 |
|
|
if (($_POST['range_to'] && !is_ipaddr($_POST['range_to']))) {
|
151 |
|
|
$input_errors[] = "A valid range must be specified.";
|
152 |
|
|
}
|
153 |
6a01ea44
|
Bill Marquette
|
if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
|
154 |
f9261419
|
Bill Marquette
|
$input_errors[] = "A valid IP address must be specified for the gateway.";
|
155 |
6a01ea44
|
Bill Marquette
|
}
|
156 |
5b237745
|
Scott Ullrich
|
if (($_POST['wins1'] && !is_ipaddr($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddr($_POST['wins2']))) {
|
157 |
4cab31d0
|
Scott Ullrich
|
$input_errors[] = "A valid IP address must be specified for the primary/secondary WINS servers.";
|
158 |
|
|
}
|
159 |
|
|
if (($_POST['dns1'] && !is_ipaddr($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddr($_POST['dns2']))) {
|
160 |
|
|
$input_errors[] = "A valid IP address must be specified for the primary/secondary DNS servers.";
|
161 |
5b237745
|
Scott Ullrich
|
}
|
162 |
|
|
if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60))) {
|
163 |
|
|
$input_errors[] = "The default lease time must be at least 60 seconds.";
|
164 |
|
|
}
|
165 |
|
|
if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime']))) {
|
166 |
|
|
$input_errors[] = "The maximum lease time must be at least 60 seconds and higher than the default lease time.";
|
167 |
|
|
}
|
168 |
4e9cd828
|
Seth Mos
|
if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain']))) {
|
169 |
|
|
$input_errors[] = "A valid domain name must be specified for the dynamic DNS registration.";
|
170 |
|
|
}
|
171 |
ad171999
|
Seth Mos
|
if (($_POST['ntp1'] && !is_ipaddr($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddr($_POST['ntp2']))) {
|
172 |
|
|
$input_errors[] = "A valid IP address must be specified for the primary/secondary NTP servers.";
|
173 |
|
|
}
|
174 |
ee1b024e
|
Martin Fuchs
|
if (($_POST['domain'] && !is_domain($_POST['domain']))) {
|
175 |
|
|
$input_errors[] = "A valid domain name must be specified for the DNS domain.";
|
176 |
|
|
}
|
177 |
|
|
if (($_POST['tftp'] && !is_ipaddr($_POST['tftp']))) {
|
178 |
|
|
$input_errors[] = "A valid IP address must be specified for the tftp server.";
|
179 |
53f926df
|
Martin Fuchs
|
}
|
180 |
4e9cd828
|
Seth Mos
|
if (($_POST['nextserver'] && !is_ipaddr($_POST['nextserver']))) {
|
181 |
|
|
$input_errors[] = "A valid IP address must be specified for the network boot server.";
|
182 |
|
|
}
|
183 |
e9f147c8
|
Scott Ullrich
|
|
184 |
5b237745
|
Scott Ullrich
|
if (!$input_errors) {
|
185 |
|
|
/* make sure the range lies within the current subnet */
|
186 |
|
|
$subnet_start = (ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet']));
|
187 |
|
|
$subnet_end = (ip2long($ifcfg['ipaddr']) | (~gen_subnet_mask_long($ifcfg['subnet'])));
|
188 |
e9f147c8
|
Scott Ullrich
|
|
189 |
5b237745
|
Scott Ullrich
|
if ((ip2long($_POST['range_from']) < $subnet_start) || (ip2long($_POST['range_from']) > $subnet_end) ||
|
190 |
|
|
(ip2long($_POST['range_to']) < $subnet_start) || (ip2long($_POST['range_to']) > $subnet_end)) {
|
191 |
e9f147c8
|
Scott Ullrich
|
$input_errors[] = "The specified range lies outside of the current subnet.";
|
192 |
5b237745
|
Scott Ullrich
|
}
|
193 |
e9f147c8
|
Scott Ullrich
|
|
194 |
5b237745
|
Scott Ullrich
|
if (ip2long($_POST['range_from']) > ip2long($_POST['range_to']))
|
195 |
|
|
$input_errors[] = "The range is invalid (first element higher than second element).";
|
196 |
e9f147c8
|
Scott Ullrich
|
|
197 |
5b237745
|
Scott Ullrich
|
/* make sure that the DHCP Relay isn't enabled on this interface */
|
198 |
|
|
if (isset($config['dhcrelay'][$if]['enable']))
|
199 |
|
|
$input_errors[] = "You must disable the DHCP relay on the {$iflist[$if]} interface before enabling the DHCP server.";
|
200 |
|
|
}
|
201 |
|
|
}
|
202 |
|
|
|
203 |
|
|
if (!$input_errors) {
|
204 |
|
|
$config['dhcpd'][$if]['range']['from'] = $_POST['range_from'];
|
205 |
|
|
$config['dhcpd'][$if]['range']['to'] = $_POST['range_to'];
|
206 |
|
|
$config['dhcpd'][$if]['defaultleasetime'] = $_POST['deftime'];
|
207 |
|
|
$config['dhcpd'][$if]['maxleasetime'] = $_POST['maxtime'];
|
208 |
48ab0cd2
|
Scott Ullrich
|
$config['dhcpd'][$if]['netmask'] = $_POST['netmask'];
|
209 |
d378c59b
|
Scott Ullrich
|
$previous = $config['dhcpd'][$if]['failover_peerip'];
|
210 |
|
|
if($previous <> $_POST['failover_peerip']) {
|
211 |
e9f147c8
|
Scott Ullrich
|
mwexec("rm -rf /var/dhcpd/var/db/*");
|
212 |
|
|
}
|
213 |
ea166a33
|
Scott Ullrich
|
$config['dhcpd'][$if]['failover_peerip'] = $_POST['failover_peerip'];
|
214 |
e9f147c8
|
Scott Ullrich
|
|
215 |
5b237745
|
Scott Ullrich
|
unset($config['dhcpd'][$if]['winsserver']);
|
216 |
|
|
if ($_POST['wins1'])
|
217 |
|
|
$config['dhcpd'][$if]['winsserver'][] = $_POST['wins1'];
|
218 |
|
|
if ($_POST['wins2'])
|
219 |
|
|
$config['dhcpd'][$if]['winsserver'][] = $_POST['wins2'];
|
220 |
4cab31d0
|
Scott Ullrich
|
|
221 |
94a9cf1a
|
Scott Ullrich
|
unset($config['dhcpd'][$if]['dnsserver']);
|
222 |
e9f147c8
|
Scott Ullrich
|
if ($_POST['dns1'])
|
223 |
06d754d4
|
Scott Ullrich
|
$config['dhcpd'][$if]['dnsserver'][] = $_POST['dns1'];
|
224 |
e9f147c8
|
Scott Ullrich
|
if ($_POST['dns2'])
|
225 |
06d754d4
|
Scott Ullrich
|
$config['dhcpd'][$if]['dnsserver'][] = $_POST['dns2'];
|
226 |
e9f147c8
|
Scott Ullrich
|
|
227 |
f9261419
|
Bill Marquette
|
$config['dhcpd'][$if]['gateway'] = $_POST['gateway'];
|
228 |
1ebf937f
|
Martin Fuchs
|
$config['dhcpd'][$if]['domain'] = $_POST['domain'];
|
229 |
9be23653
|
Martin Fuchs
|
$config['dhcpd'][$if]['domainsearchlist'] = $_POST['domainsearchlist'];
|
230 |
6a01ea44
|
Bill Marquette
|
$config['dhcpd'][$if]['denyunknown'] = ($_POST['denyunknown']) ? true : false;
|
231 |
|
|
$config['dhcpd'][$if]['enable'] = ($_POST['enable']) ? true : false;
|
232 |
|
|
$config['dhcpd'][$if]['staticarp'] = ($_POST['staticarp']) ? true : false;
|
233 |
4e9cd828
|
Seth Mos
|
$config['dhcpd'][$if]['ddnsdomain'] = $_POST['ddnsdomain'];
|
234 |
|
|
$config['dhcpd'][$if]['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false;
|
235 |
ad171999
|
Seth Mos
|
|
236 |
|
|
unset($config['dhcpd'][$if]['ntpserver']);
|
237 |
|
|
if ($_POST['ntp1'])
|
238 |
|
|
$config['dhcpd'][$if]['ntpserver'][] = $_POST['ntp1'];
|
239 |
|
|
if ($_POST['ntp2'])
|
240 |
|
|
$config['dhcpd'][$if]['ntpserver'][] = $_POST['ntp2'];
|
241 |
|
|
|
242 |
6c23757b
|
Martin Fuchs
|
$config['dhcpd'][$if]['tftp'] = $_POST['tftp'];
|
243 |
|
|
$config['dhcpd'][$if]['ldap'] = $_POST['ldap'];
|
244 |
4e9cd828
|
Seth Mos
|
$config['dhcpd'][$if]['netboot'] = ($_POST['netboot']) ? true : false;
|
245 |
|
|
$config['dhcpd'][$if]['next-server'] = $_POST['nextserver'];
|
246 |
|
|
$config['dhcpd'][$if]['filename'] = $_POST['filename'];
|
247 |
ee1b024e
|
Martin Fuchs
|
$config['dhcpd'][$if]['rootpath'] = $_POST['rootpath'];
|
248 |
9c748b70
|
Scott Ullrich
|
|
249 |
5b237745
|
Scott Ullrich
|
write_config();
|
250 |
80933129
|
Bill Marquette
|
|
251 |
|
|
/* static arp configuration */
|
252 |
c5a0fd3c
|
Scott Ullrich
|
interfaces_staticarp_configure($if);
|
253 |
e9f147c8
|
Scott Ullrich
|
|
254 |
5b237745
|
Scott Ullrich
|
$retval = 0;
|
255 |
6a01ea44
|
Bill Marquette
|
$retvaldhcp = 0;
|
256 |
|
|
$retvaldns = 0;
|
257 |
824edb6c
|
Scott Ullrich
|
config_lock();
|
258 |
6a01ea44
|
Bill Marquette
|
/* dnsmasq_configure calls dhcpd_configure */
|
259 |
|
|
/* no need to restart dhcpd twice */
|
260 |
|
|
if (isset($config['dnsmasq']['regdhcpstatic'])) {
|
261 |
|
|
$retvaldns = services_dnsmasq_configure();
|
262 |
|
|
if ($retvaldns == 0) {
|
263 |
|
|
if (file_exists($d_hostsdirty_path))
|
264 |
|
|
unlink($d_hostsdirty_path);
|
265 |
|
|
if (file_exists($d_staticmapsdirty_path))
|
266 |
|
|
unlink($d_staticmapsdirty_path);
|
267 |
|
|
}
|
268 |
|
|
} else {
|
269 |
|
|
$retvaldhcp = services_dhcpd_configure();
|
270 |
|
|
if ($retvaldhcp == 0) {
|
271 |
|
|
if (file_exists($d_staticmapsdirty_path))
|
272 |
|
|
unlink($d_staticmapsdirty_path);
|
273 |
|
|
}
|
274 |
|
|
}
|
275 |
824edb6c
|
Scott Ullrich
|
config_unlock();
|
276 |
6a01ea44
|
Bill Marquette
|
if($retvaldhcp == 1 || $retvaldns == 1)
|
277 |
|
|
$retval = 1;
|
278 |
5b237745
|
Scott Ullrich
|
$savemsg = get_std_save_message($retval);
|
279 |
|
|
}
|
280 |
|
|
}
|
281 |
|
|
|
282 |
|
|
if ($_GET['act'] == "del") {
|
283 |
|
|
if ($a_maps[$_GET['id']]) {
|
284 |
|
|
unset($a_maps[$_GET['id']]);
|
285 |
|
|
write_config();
|
286 |
6a01ea44
|
Bill Marquette
|
if(isset($config['dhcpd'][$if]['enable'])) {
|
287 |
|
|
touch($d_staticmapsdirty_path);
|
288 |
|
|
if (isset($config['dnsmasq']['regdhcpstatic']))
|
289 |
|
|
touch($d_hostsdirty_path);
|
290 |
|
|
}
|
291 |
5b237745
|
Scott Ullrich
|
header("Location: services_dhcp.php?if={$if}");
|
292 |
|
|
exit;
|
293 |
|
|
}
|
294 |
|
|
}
|
295 |
4df96eff
|
Scott Ullrich
|
|
296 |
d88c6a9f
|
Scott Ullrich
|
$pgtitle = array("Services","DHCP server");
|
297 |
4df96eff
|
Scott Ullrich
|
include("head.inc");
|
298 |
|
|
|
299 |
5b237745
|
Scott Ullrich
|
?>
|
300 |
4df96eff
|
Scott Ullrich
|
|
301 |
4e9cd828
|
Seth Mos
|
<script type="text/javascript" language="JavaScript">
|
302 |
|
|
|
303 |
5b237745
|
Scott Ullrich
|
function enable_change(enable_over) {
|
304 |
07bd3f83
|
Scott Ullrich
|
var endis;
|
305 |
|
|
endis = !(document.iform.enable.checked || enable_over);
|
306 |
|
|
document.iform.range_from.disabled = endis;
|
307 |
|
|
document.iform.range_to.disabled = endis;
|
308 |
|
|
document.iform.wins1.disabled = endis;
|
309 |
|
|
document.iform.wins2.disabled = endis;
|
310 |
4cab31d0
|
Scott Ullrich
|
document.iform.dns1.disabled = endis;
|
311 |
|
|
document.iform.dns2.disabled = endis;
|
312 |
07bd3f83
|
Scott Ullrich
|
document.iform.deftime.disabled = endis;
|
313 |
|
|
document.iform.maxtime.disabled = endis;
|
314 |
f9261419
|
Bill Marquette
|
document.iform.gateway.disabled = endis;
|
315 |
fcffbd13
|
Scott Ullrich
|
document.iform.failover_peerip.disabled = endis;
|
316 |
1ebf937f
|
Martin Fuchs
|
document.iform.domain.disabled = endis;
|
317 |
9be23653
|
Martin Fuchs
|
document.iform.domainsearchlist.disabled = endis;
|
318 |
db6b2be4
|
Scott Ullrich
|
document.iform.staticarp.disabled = endis;
|
319 |
4e9cd828
|
Seth Mos
|
document.iform.ddnsdomain.disabled = endis;
|
320 |
|
|
document.iform.ddnsupdate.disabled = endis;
|
321 |
ad171999
|
Seth Mos
|
document.iform.ntp1.disabled = endis;
|
322 |
|
|
document.iform.ntp2.disabled = endis;
|
323 |
6c23757b
|
Martin Fuchs
|
document.iform.tftp.disabled = endis;
|
324 |
|
|
document.iform.ldap.disabled = endis;
|
325 |
4e9cd828
|
Seth Mos
|
document.iform.netboot.disabled = endis;
|
326 |
|
|
document.iform.nextserver.disabled = endis;
|
327 |
|
|
document.iform.filename.disabled = endis;
|
328 |
ee1b024e
|
Martin Fuchs
|
document.iform.rootpath.disabled = endis;
|
329 |
7ceb4368
|
Scott Ullrich
|
document.iform.denyunknown.disabled = endis;
|
330 |
5b237745
|
Scott Ullrich
|
}
|
331 |
4e9cd828
|
Seth Mos
|
|
332 |
|
|
function show_ddns_config() {
|
333 |
|
|
document.getElementById("showddnsbox").innerHTML='';
|
334 |
|
|
aodiv = document.getElementById('showddns');
|
335 |
|
|
aodiv.style.display = "block";
|
336 |
|
|
}
|
337 |
|
|
|
338 |
ad171999
|
Seth Mos
|
function show_ntp_config() {
|
339 |
|
|
document.getElementById("showntpbox").innerHTML='';
|
340 |
|
|
aodiv = document.getElementById('showntp');
|
341 |
|
|
aodiv.style.display = "block";
|
342 |
|
|
}
|
343 |
|
|
|
344 |
6c23757b
|
Martin Fuchs
|
function show_tftp_config() {
|
345 |
|
|
document.getElementById("showtftpbox").innerHTML='';
|
346 |
|
|
aodiv = document.getElementById('showtftp');
|
347 |
|
|
aodiv.style.display = "block";
|
348 |
|
|
}
|
349 |
|
|
|
350 |
|
|
function show_ldap_config() {
|
351 |
|
|
document.getElementById("showldapbox").innerHTML='';
|
352 |
|
|
aodiv = document.getElementById('showldap');
|
353 |
|
|
aodiv.style.display = "block";
|
354 |
|
|
}
|
355 |
|
|
|
356 |
4e9cd828
|
Seth Mos
|
function show_netboot_config() {
|
357 |
|
|
document.getElementById("shownetbootbox").innerHTML='';
|
358 |
|
|
aodiv = document.getElementById('shownetboot');
|
359 |
|
|
aodiv.style.display = "block";
|
360 |
|
|
}
|
361 |
|
|
|
362 |
5b237745
|
Scott Ullrich
|
</script>
|
363 |
|
|
|
364 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
365 |
b7597d4e
|
Bill Marquette
|
<?php include("fbegin.inc"); ?>
|
366 |
5b237745
|
Scott Ullrich
|
<form action="services_dhcp.php" method="post" name="iform" id="iform">
|
367 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
368 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
369 |
3d7b7757
|
Chris Buechler
|
<?php
|
370 |
|
|
if ($dhcrelay_enabled) {
|
371 |
|
|
echo "DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.";
|
372 |
|
|
include("fend.inc");
|
373 |
|
|
echo "</body>";
|
374 |
|
|
echo "</html>";
|
375 |
|
|
exit;
|
376 |
|
|
}
|
377 |
49b94d3a
|
Chris Buechler
|
if ($singleif_nostaticip) {
|
378 |
|
|
echo "<b>The DHCP Server can only be enabled on interfaces configured with static IP addresses. Your interface is not configured with a static IP.</b>";
|
379 |
|
|
include("fend.inc");
|
380 |
|
|
echo "</body>";
|
381 |
|
|
echo "</html>";
|
382 |
|
|
exit;
|
383 |
|
|
}
|
384 |
3d7b7757
|
Chris Buechler
|
?>
|
385 |
5b237745
|
Scott Ullrich
|
<?php if (file_exists($d_staticmapsdirty_path)): ?><p>
|
386 |
|
|
<?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>
|
387 |
|
|
<?php endif; ?>
|
388 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
389 |
|
|
<tr><td>
|
390 |
f0cdf141
|
Scott Ullrich
|
<?php
|
391 |
|
|
/* active tabs */
|
392 |
|
|
$tab_array = array();
|
393 |
|
|
$tabscounter = 0;
|
394 |
|
|
$i = 0;
|
395 |
|
|
foreach ($iflist as $ifent => $ifname) {
|
396 |
|
|
if ($ifent == $if)
|
397 |
|
|
$active = true;
|
398 |
|
|
else
|
399 |
|
|
$active = false;
|
400 |
|
|
$tab_array[] = array($ifname, $active, "services_dhcp.php?if={$ifent}");
|
401 |
|
|
}
|
402 |
|
|
display_top_tabs($tab_array);
|
403 |
|
|
?>
|
404 |
5b237745
|
Scott Ullrich
|
</td></tr>
|
405 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
406 |
d732f186
|
Bill Marquette
|
<td>
|
407 |
|
|
<div id="mainarea">
|
408 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
|
409 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
410 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vtable"> </td>
|
411 |
|
|
<td width="78%" class="vtable">
|
412 |
8c65eb75
|
Scott Ullrich
|
<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
|
413 |
e9f147c8
|
Scott Ullrich
|
<strong>Enable DHCP server on
|
414 |
5b237745
|
Scott Ullrich
|
<?=htmlspecialchars($iflist[$if]);?>
|
415 |
|
|
interface</strong></td>
|
416 |
|
|
</tr>
|
417 |
|
|
<tr>
|
418 |
|
|
<td width="22%" valign="top" class="vtable"> </td>
|
419 |
|
|
<td width="78%" class="vtable">
|
420 |
8c65eb75
|
Scott Ullrich
|
<input name="denyunknown" id="denyunknown" type="checkbox" value="yes" <?php if ($pconfig['denyunknown']) echo "checked"; ?>>
|
421 |
5b237745
|
Scott Ullrich
|
<strong>Deny unknown clients</strong><br>
|
422 |
|
|
If this is checked, only the clients defined below will get DHCP leases from this server. </td>
|
423 |
|
|
</tr>
|
424 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
425 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncellreq">Subnet</td>
|
426 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
427 |
5b237745
|
Scott Ullrich
|
<?=gen_subnet($ifcfg['ipaddr'], $ifcfg['subnet']);?>
|
428 |
|
|
</td>
|
429 |
|
|
</tr>
|
430 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
431 |
|
|
<td width="22%" valign="top" class="vncellreq">Subnet
|
432 |
5b237745
|
Scott Ullrich
|
mask</td>
|
433 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
434 |
5b237745
|
Scott Ullrich
|
<?=gen_subnet_mask($ifcfg['subnet']);?>
|
435 |
|
|
</td>
|
436 |
|
|
</tr>
|
437 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
438 |
|
|
<td width="22%" valign="top" class="vncellreq">Available
|
439 |
5b237745
|
Scott Ullrich
|
range</td>
|
440 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
441 |
5b237745
|
Scott Ullrich
|
<?=long2ip(ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet']));?>
|
442 |
e9f147c8
|
Scott Ullrich
|
-
|
443 |
5b237745
|
Scott Ullrich
|
<?=long2ip(ip2long($ifcfg['ipaddr']) | (~gen_subnet_mask_long($ifcfg['subnet']))); ?>
|
444 |
|
|
</td>
|
445 |
|
|
</tr>
|
446 |
48ab0cd2
|
Scott Ullrich
|
<?php if($is_olsr_enabled): ?>
|
447 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
448 |
48ab0cd2
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncellreq">Subnet Mask</td>
|
449 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
450 |
b5c78501
|
Seth Mos
|
<select name="netmask" class="formselect" id="netmask">
|
451 |
48ab0cd2
|
Scott Ullrich
|
<?php
|
452 |
|
|
for ($i = 32; $i > 0; $i--) {
|
453 |
|
|
if($i <> 31) {
|
454 |
|
|
echo "<option value=\"{$i}\" ";
|
455 |
983c0b1f
|
Scott Ullrich
|
if ($i == $pconfig['netmask']) echo "selected";
|
456 |
48ab0cd2
|
Scott Ullrich
|
echo ">" . $i . "</option>";
|
457 |
|
|
}
|
458 |
|
|
}
|
459 |
|
|
?>
|
460 |
|
|
</select>
|
461 |
|
|
</td>
|
462 |
|
|
</tr>
|
463 |
e9f147c8
|
Scott Ullrich
|
<?php endif; ?>
|
464 |
|
|
<tr>
|
465 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncellreq">Range</td>
|
466 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
467 |
b5c78501
|
Seth Mos
|
<input name="range_from" type="text" class="formfld unknown" id="range_from" size="20" value="<?=htmlspecialchars($pconfig['range_from']);?>">
|
468 |
|
|
to <input name="range_to" type="text" class="formfld unknown" id="range_to" size="20" value="<?=htmlspecialchars($pconfig['range_to']);?>">
|
469 |
25e031a1
|
Scott Ullrich
|
</td>
|
470 |
5b237745
|
Scott Ullrich
|
</tr>
|
471 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
472 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncell">WINS servers</td>
|
473 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
474 |
b5c78501
|
Seth Mos
|
<input name="wins1" type="text" class="formfld unknown" id="wins1" size="20" value="<?=htmlspecialchars($pconfig['wins1']);?>"><br>
|
475 |
|
|
<input name="wins2" type="text" class="formfld unknown" id="wins2" size="20" value="<?=htmlspecialchars($pconfig['wins2']);?>">
|
476 |
25e031a1
|
Scott Ullrich
|
</td>
|
477 |
5b237745
|
Scott Ullrich
|
</tr>
|
478 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
479 |
4cab31d0
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncell">DNS servers</td>
|
480 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
481 |
b5c78501
|
Seth Mos
|
<input name="dns1" type="text" class="formfld unknown" id="dns1" size="20" value="<?=htmlspecialchars($pconfig['dns1']);?>"><br>
|
482 |
|
|
<input name="dns2" type="text" class="formfld unknown" id="dns2" size="20" value="<?=htmlspecialchars($pconfig['dns2']);?>"><br>
|
483 |
f5fc3deb
|
Chris Buechler
|
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.
|
484 |
25e031a1
|
Scott Ullrich
|
</td>
|
485 |
4cab31d0
|
Scott Ullrich
|
</tr>
|
486 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
487 |
b7597d4e
|
Bill Marquette
|
<td width="22%" valign="top" class="vncell">Gateway</td>
|
488 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
489 |
b5c78501
|
Seth Mos
|
<input name="gateway" type="text" class="formfld host" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"><br>
|
490 |
f5fc3deb
|
Chris Buechler
|
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.
|
491 |
e9f147c8
|
Scott Ullrich
|
</td>
|
492 |
1ebf937f
|
Martin Fuchs
|
</tr>
|
493 |
9be23653
|
Martin Fuchs
|
<tr>
|
494 |
1ebf937f
|
Martin Fuchs
|
<td width="22%" valign="top" class="vncell">Domain-Name</td>
|
495 |
|
|
<td width="78%" class="vtable">
|
496 |
b5c78501
|
Seth Mos
|
<input name="domain" type="text" class="formfld unknown" id="domain" size="20" value="<?=htmlspecialchars($pconfig['domain']);?>"><br>
|
497 |
1ebf937f
|
Martin Fuchs
|
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.
|
498 |
|
|
</td>
|
499 |
2af4c579
|
Scott Ullrich
|
</tr>
|
500 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
501 |
9be23653
|
Martin Fuchs
|
<td width="22%" valign="top" class="vncell">Domain-Searchlist</td>
|
502 |
|
|
<td width="78%" class="vtable">
|
503 |
b5c78501
|
Seth Mos
|
<input name="domainsearchlist" type="text" class="formfld unknown" id="domainsearchlist" size="20" value="<?=htmlspecialchars($pconfig['domainsearchlist']);?>"><br>
|
504 |
9be23653
|
Martin Fuchs
|
DNS-Searchlist: the DHCP server can serve a list of domains to be searched.
|
505 |
|
|
</td>
|
506 |
|
|
</tr>
|
507 |
|
|
<tr>
|
508 |
|
|
<td width="22%" valign="top" class="vncell">Default lease time</td>
|
509 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
510 |
b5c78501
|
Seth Mos
|
<input name="deftime" type="text" class="formfld unknown" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>">
|
511 |
5b237745
|
Scott Ullrich
|
seconds<br>
|
512 |
e9f147c8
|
Scott Ullrich
|
This is used for clients that do not ask for a specific
|
513 |
5b237745
|
Scott Ullrich
|
expiration time.<br>
|
514 |
2af4c579
|
Scott Ullrich
|
The default is 7200 seconds.
|
515 |
|
|
</td>
|
516 |
5b237745
|
Scott Ullrich
|
</tr>
|
517 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
518 |
9be23653
|
Martin Fuchs
|
<td width="22%" valign="top" class="vncell">Maximum lease time</td>
|
519 |
e9f147c8
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
520 |
b5c78501
|
Seth Mos
|
<input name="maxtime" type="text" class="formfld unknown" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>">
|
521 |
5b237745
|
Scott Ullrich
|
seconds<br>
|
522 |
e9f147c8
|
Scott Ullrich
|
This is the maximum lease time for clients that ask
|
523 |
5b237745
|
Scott Ullrich
|
for a specific expiration time.<br>
|
524 |
2af4c579
|
Scott Ullrich
|
The default is 86400 seconds.
|
525 |
|
|
</td>
|
526 |
5b237745
|
Scott Ullrich
|
</tr>
|
527 |
ea166a33
|
Scott Ullrich
|
<tr>
|
528 |
|
|
<td width="22%" valign="top" class="vncell">Failover peer IP:</td>
|
529 |
|
|
<td width="78%" class="vtable">
|
530 |
b5c78501
|
Seth Mos
|
<input name="failover_peerip" type="text" class="formfld host" id="failover_peerip" size="20" value="<?=htmlspecialchars($pconfig['failover_peerip']);?>"><br>
|
531 |
be586e5f
|
Scott Ullrich
|
Leave blank to disable. Enter the REAL address of the other machine. Machines must be using CARP.
|
532 |
ea166a33
|
Scott Ullrich
|
</td>
|
533 |
|
|
</tr>
|
534 |
f1da88f6
|
Bill Marquette
|
<tr>
|
535 |
|
|
<td width="22%" valign="top" class="vncell">Static ARP</td>
|
536 |
e44a0096
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
537 |
|
|
<table>
|
538 |
2af4c579
|
Scott Ullrich
|
<tr>
|
539 |
|
|
<td>
|
540 |
|
|
<input valign="middle" type="checkbox" value="yes" name="staticarp" id="staticarp" <?php if($pconfig['staticarp']) echo " checked"; ?>>
|
541 |
|
|
</td>
|
542 |
|
|
<td>
|
543 |
|
|
<b>Enable Static ARP entries</b>
|
544 |
|
|
</td>
|
545 |
|
|
</tr>
|
546 |
|
|
<tr>
|
547 |
|
|
<td>
|
548 |
|
|
|
549 |
|
|
</td>
|
550 |
|
|
<td>
|
551 |
c5a0fd3c
|
Scott Ullrich
|
<span class="red"><strong>Note:</strong></span> Only the machines listed below will be able to communicate with the firewall on this NIC.
|
552 |
2af4c579
|
Scott Ullrich
|
</td>
|
553 |
|
|
</tr>
|
554 |
e44a0096
|
Scott Ullrich
|
</table>
|
555 |
|
|
</td>
|
556 |
f1da88f6
|
Bill Marquette
|
</tr>
|
557 |
4e9cd828
|
Seth Mos
|
<tr>
|
558 |
|
|
<td width="22%" valign="top" class="vncell">Dynamic DNS</td>
|
559 |
|
|
<td width="78%" class="vtable">
|
560 |
|
|
<div id="showddnsbox">
|
561 |
|
|
<input type="button" onClick="show_ddns_config()" value="Advanced"></input> - Show Dynamic DNS</a>
|
562 |
|
|
</div>
|
563 |
|
|
<div id="showddns" style="display:none">
|
564 |
|
|
<input valign="middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if($pconfig['ddnsupdate']) echo " checked"; ?>>
|
565 |
|
|
<b>Enable registration of DHCP client names in DNS.</b><br />
|
566 |
|
|
<p>
|
567 |
b5c78501
|
Seth Mos
|
<input name="ddnsdomain" type="text" class="formfld unknown" id="ddnsdomain" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>"><br />
|
568 |
4e9cd828
|
Seth Mos
|
Note: Leave blank to disable dynamic DNS registration.<br />
|
569 |
|
|
Enter the dynamic DNS domain which will be used to register client names in the DNS server.
|
570 |
|
|
</div>
|
571 |
|
|
</td>
|
572 |
|
|
</tr>
|
573 |
ad171999
|
Seth Mos
|
<tr>
|
574 |
|
|
<td width="22%" valign="top" class="vncell">NTP servers</td>
|
575 |
|
|
<td width="78%" class="vtable">
|
576 |
|
|
<div id="showntpbox">
|
577 |
|
|
<input type="button" onClick="show_ntp_config()" value="Advanced"></input> - Show NTP configuration</a>
|
578 |
|
|
</div>
|
579 |
|
|
<div id="showntp" style="display:none">
|
580 |
b5c78501
|
Seth Mos
|
<input name="ntp1" type="text" class="formfld unknown" id="ntp1" size="20" value="<?=htmlspecialchars($pconfig['ntp1']);?>"><br>
|
581 |
|
|
<input name="ntp2" type="text" class="formfld unknown" id="ntp2" size="20" value="<?=htmlspecialchars($pconfig['ntp2']);?>">
|
582 |
ad171999
|
Seth Mos
|
</div>
|
583 |
|
|
</td>
|
584 |
|
|
</tr>
|
585 |
6c23757b
|
Martin Fuchs
|
<tr>
|
586 |
|
|
<td width="22%" valign="top" class="vncell">TFTP server</td>
|
587 |
|
|
<td width="78%" class="vtable">
|
588 |
|
|
<div id="showtftpbox">
|
589 |
|
|
<input type="button" onClick="show_tftp_config()" value="Advanced"></input> - Show TFTP configuration</a>
|
590 |
|
|
</div>
|
591 |
|
|
<div id="showtftp" style="display:none">
|
592 |
b5c78501
|
Seth Mos
|
<input name="tftp" type="text" class="formfld unknown" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>"><br>
|
593 |
6c23757b
|
Martin Fuchs
|
Leave blank to disable. Enter a full hostname or IP for the TFTP server.
|
594 |
|
|
</div>
|
595 |
|
|
</td>
|
596 |
|
|
</tr>
|
597 |
|
|
<tr>
|
598 |
|
|
<td width="22%" valign="top" class="vncell">LDAP URI</td>
|
599 |
|
|
<td width="78%" class="vtable">
|
600 |
|
|
<div id="showldapbox">
|
601 |
|
|
<input type="button" onClick="show_ldap_config()" value="Advanced"></input> - Show LDAP configuration</a>
|
602 |
|
|
</div>
|
603 |
|
|
<div id="showldap" style="display:none">
|
604 |
b5c78501
|
Seth Mos
|
<input name="ldap" type="text" class="formfld unknown" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>"><br>
|
605 |
6c23757b
|
Martin Fuchs
|
Leave blank to disable. Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com
|
606 |
|
|
</div>
|
607 |
|
|
</td>
|
608 |
|
|
</tr>
|
609 |
4e9cd828
|
Seth Mos
|
<tr>
|
610 |
|
|
<td width="22%" valign="top" class="vncell">Enable Network booting</td>
|
611 |
|
|
<td width="78%" class="vtable">
|
612 |
|
|
<div id="shownetbootbox">
|
613 |
|
|
<input type="button" onClick="show_netboot_config()" value="Advanced"></input> - Show Network booting</a>
|
614 |
|
|
</div>
|
615 |
|
|
<div id="shownetboot" style="display:none">
|
616 |
|
|
<input valign="middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if($pconfig['netboot']) echo " checked"; ?>>
|
617 |
|
|
<b>Enables network booting.</b>
|
618 |
|
|
<p>
|
619 |
ee1b024e
|
Martin Fuchs
|
Enter the IP of the <b>next-server</b>
|
620 |
b5c78501
|
Seth Mos
|
<input name="nextserver" type="text" class="formfld unknown" id="nextserver" size="20" value="<?=htmlspecialchars($pconfig['nextserver']);?>">
|
621 |
ee1b024e
|
Martin Fuchs
|
and the filename
|
622 |
b5c78501
|
Seth Mos
|
<input name="filename" type="text" class="formfld unknown" id="filename" size="20" value="<?=htmlspecialchars($pconfig['filename']);?>"><br>
|
623 |
4e9cd828
|
Seth Mos
|
Note: You need both a filename and a boot server configured for this to work!
|
624 |
ee1b024e
|
Martin Fuchs
|
<p>
|
625 |
ca126e03
|
Martin Fuchs
|
Enter the <b>root-path</b>-string
|
626 |
b5c78501
|
Seth Mos
|
<input name="rootpath" type="text" class="formfld unknown" id="rootpath" size="90" value="<?=htmlspecialchars($pconfig['rootpath']);?>"><br>
|
627 |
ca126e03
|
Martin Fuchs
|
Note: string-format: iscsi:(servername):(protocol):(port):(LUN):targetname
|
628 |
ee1b024e
|
Martin Fuchs
|
</div>
|
629 |
4e9cd828
|
Seth Mos
|
</td>
|
630 |
ee1b024e
|
Martin Fuchs
|
</tr>
|
631 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
632 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top"> </td>
|
633 |
e9f147c8
|
Scott Ullrich
|
<td width="78%">
|
634 |
|
|
<input name="if" type="hidden" value="<?=$if;?>">
|
635 |
|
|
<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
|
636 |
5b237745
|
Scott Ullrich
|
</td>
|
637 |
|
|
</tr>
|
638 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
639 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top"> </td>
|
640 |
|
|
<td width="78%"> <p><span class="vexpl"><span class="red"><strong>Note:<br>
|
641 |
e9f147c8
|
Scott Ullrich
|
</strong></span>The DNS servers entered in <a href="system.php">System:
|
642 |
|
|
General setup</a> (or the <a href="services_dnsmasq.php">DNS
|
643 |
|
|
forwarder</a>, if enabled) </span><span class="vexpl">will
|
644 |
5b237745
|
Scott Ullrich
|
be assigned to clients by the DHCP server.<br>
|
645 |
|
|
<br>
|
646 |
f056270d
|
Scott Ullrich
|
The DHCP lease table can be viewed on the <a href="diag_dhcp_leases.php">Status:
|
647 |
5b237745
|
Scott Ullrich
|
DHCP leases</a> page.<br>
|
648 |
2af4c579
|
Scott Ullrich
|
</span></p>
|
649 |
|
|
</td>
|
650 |
5b237745
|
Scott Ullrich
|
</tr>
|
651 |
|
|
</table>
|
652 |
d732f186
|
Bill Marquette
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
653 |
5b237745
|
Scott Ullrich
|
<tr>
|
654 |
6a01ea44
|
Bill Marquette
|
<td width="25%" class="listhdrr">MAC address</td>
|
655 |
|
|
<td width="15%" class="listhdrr">IP address</td>
|
656 |
|
|
<td width="20%" class="listhdrr">Hostname</td>
|
657 |
|
|
<td width="30%" class="listhdr">Description</td>
|
658 |
2af4c579
|
Scott Ullrich
|
<td width="10%" class="list">
|
659 |
d415d821
|
Seth Mos
|
<table border="0" cellspacing="0" cellpadding="1">
|
660 |
|
|
<tr>
|
661 |
|
|
<td valign="middle" width="17"></td>
|
662 |
|
|
<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>
|
663 |
|
|
</tr>
|
664 |
|
|
</table>
|
665 |
2af4c579
|
Scott Ullrich
|
</td>
|
666 |
|
|
</tr>
|
667 |
6f5b2c3e
|
Scott Ullrich
|
<?php if(is_array($a_maps)): ?>
|
668 |
5b237745
|
Scott Ullrich
|
<?php $i = 0; foreach ($a_maps as $mapent): ?>
|
669 |
11c9bb94
|
Scott Ullrich
|
<?php if($mapent['mac'] <> "" or $mapent['ipaddr'] <> ""): ?>
|
670 |
5b237745
|
Scott Ullrich
|
<tr>
|
671 |
2d165eff
|
Bill Marquette
|
<td class="listlr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
|
672 |
5b237745
|
Scott Ullrich
|
<?=htmlspecialchars($mapent['mac']);?>
|
673 |
|
|
</td>
|
674 |
2d165eff
|
Bill Marquette
|
<td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
|
675 |
5b237745
|
Scott Ullrich
|
<?=htmlspecialchars($mapent['ipaddr']);?>
|
676 |
|
|
</td>
|
677 |
6a01ea44
|
Bill Marquette
|
<td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
|
678 |
|
|
<?=htmlspecialchars($mapent['hostname']);?>
|
679 |
|
|
</td>
|
680 |
2d165eff
|
Bill Marquette
|
<td class="listbg" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
|
681 |
588b7fc5
|
Bill Marquette
|
<font color="#FFFFFF"><?=htmlspecialchars($mapent['descr']);?> </font>
|
682 |
5b237745
|
Scott Ullrich
|
</td>
|
683 |
75a70796
|
Bill Marquette
|
<td valign="middle" nowrap class="list">
|
684 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
685 |
|
|
<tr>
|
686 |
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>
|
687 |
|
|
<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>
|
688 |
75a70796
|
Bill Marquette
|
</tr>
|
689 |
|
|
</table>
|
690 |
|
|
</td>
|
691 |
|
|
</tr>
|
692 |
6f5b2c3e
|
Scott Ullrich
|
<?php endif; ?>
|
693 |
75a70796
|
Bill Marquette
|
<?php $i++; endforeach; ?>
|
694 |
6f5b2c3e
|
Scott Ullrich
|
<?php endif; ?>
|
695 |
e9f147c8
|
Scott Ullrich
|
<tr>
|
696 |
6a01ea44
|
Bill Marquette
|
<td class="list" colspan="4"></td>
|
697 |
75a70796
|
Bill Marquette
|
<td class="list">
|
698 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
699 |
|
|
<tr>
|
700 |
d415d821
|
Seth Mos
|
<td valign="middle" width="17"></td>
|
701 |
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>
|
702 |
75a70796
|
Bill Marquette
|
</tr>
|
703 |
|
|
</table>
|
704 |
|
|
</td>
|
705 |
|
|
</tr>
|
706 |
5b237745
|
Scott Ullrich
|
</table>
|
707 |
d732f186
|
Bill Marquette
|
</div>
|
708 |
5b237745
|
Scott Ullrich
|
</td>
|
709 |
|
|
</tr>
|
710 |
|
|
</table>
|
711 |
|
|
</form>
|
712 |
|
|
<script language="JavaScript">
|
713 |
|
|
<!--
|
714 |
|
|
enable_change(false);
|
715 |
|
|
//-->
|
716 |
|
|
</script>
|
717 |
b7597d4e
|
Bill Marquette
|
<?php include("fend.inc"); ?>
|
718 |
5b237745
|
Scott Ullrich
|
</body>
|
719 |
|
|
</html>
|