1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
3 (c) 2005 U.S. Robotics Corporation
7 <title>LAN » DHCP Server</title>
9 <link href="usr_main.css" rel="stylesheet" type="text/css">
10 <script src="usr_menus.js" type="text/javascript"></script>
11 <script src="usr_common.js" type="text/javascript"></script>
13 <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
15 <script type="text/javascript" src="util.js"></script>
16 <script type="text/javascript">
18 setPageTitle("<%ejGetWl(wlInterface)%>");
20 var state = '<%ejGet(lanRefresh)%>';
22 var code = 'location.assign("lancfg2.cgi?lanRefresh=0")';
26 var dhcpStart = '<%ejGet(dhcpEthStart)%>';
27 var dhcpEnd = '<%ejGet(dhcpEthEnd)%>';
28 var dhcpLease = '<%ejGet(dhcpLeasedTime)%>';
29 var proto = '<%ejGetOther(sysInfo, noBrPrtcl)%>';
30 var ipExt = '<%ejGetOther(sysInfo, pppIpExtension)%>';
31 var dhcpEnbl = '<%ejGet(enblDhcpSrv)%>';
32 var natEnbl = '<%ejGetOther(sysInfo, enblNat)%>';
33 var enblUpnp = '<%ejGet(enblUpnp)%>';
34 var buildUpnp = '<%ejGetOther(sysInfo, buildUpnp)%>';
35 var enblStp = '<%ejGet(enblStp)%>';
37 function hideStpInfo(hide) {
38 var status = 'visible';
42 if (document.getElementById) // DOM3 = IE5, NS6
43 document.getElementById('idStp').style.visibility = status;
45 if (document.layers == false) // IE4
46 document.all.idStp.style.visibility = status;
50 function hideUpnpInfo(hide) {
51 var status = 'visible';
55 if (document.getElementById) // DOM3 = IE5, NS6
56 document.getElementById('upnpInfo').style.visibility = status;
58 if (document.layers == false) // IE4
59 document.all.upnpInfo.style.visibility = status;
63 function hideDhcpInfo(hide) {
64 var status = 'visible';
68 if (document.getElementById) // DOM3 = IE5, NS6
69 document.getElementById('dhcpInfo').style.visibility = status;
71 if (document.layers == false) // IE4
72 document.all.dhcpInfo.style.visibility = status;
76 function disableDhcpSrv() {
77 with ( document.forms[0] ) {
78 dhcpSrvType[1].checked = false;
79 dhcpEthStart.disabled = 1;
80 dhcpEthEnd.disabled = 1;
81 dhcpLeasedTime.value = '';
82 dhcpLeasedTime.disabled = 1;
86 function enableDhcpSrv(formLoad) {
87 with ( document.forms[0] ) {
88 dhcpSrvType[1].checked = true;
89 dhcpEthStart.disabled = 0;
90 dhcpEthEnd.disabled = 0;
92 setDhcpAddresses(ethIpAddress.value);
94 dhcpEthStart.value = dhcpStart;
95 dhcpEthEnd.value = dhcpEnd;
97 dhcpLeasedTime.value = dhcpLease;
98 dhcpLeasedTime.disabled = 0;
102 function hideRelayInfo(hide) {
103 var status = 'visible';
107 if (document.getElementById) // DOM3 = IE5, NS6
108 document.getElementById('relayInfo').style.visibility = status;
110 if (document.layers == false) // IE4
111 document.all.relayInfo.style.visibility = status;
115 function disableDhcpSrvRelay() {
116 with ( document.forms[0] ) {
117 dhcpSrvType[2].checked = false;
118 dhcpSrvAddr.disabled = 1;
122 function enableDhcpSrvRelay() {
123 with ( document.forms[0] ) {
124 dhcpSrvType[2].checked = true;
125 if (dhcpEthStart.value != "")
126 dhcpSrvAddr.value = dhcpEthStart.value;
128 dhcpSrvAddr.value = dhcpStart;
129 dhcpSrvAddr.disabled = 0;
133 function typeClick() {
134 with ( document.forms[0] ) {
135 // if any protocol has NAT enabled then
136 // don't show DHCP relay
137 if ( natEnbl == '1' ) {
138 if ( dhcpSrvType[0].checked == true )
143 if ( dhcpSrvType[0].checked == true ) {
145 disableDhcpSrvRelay();
146 } else if ( dhcpSrvType[1].checked == true ) {
148 disableDhcpSrvRelay();
150 enableDhcpSrvRelay();
158 with ( document.forms[0] ) {
159 ethIpAddress.value = '<%ejGet(ethIpAddress)%>';
160 ethSubnetMask.value = '<%ejGet(ethSubnetMask)%>';
162 if ( natEnbl == '1' && buildUpnp == '1' ) {
163 if ( enblUpnp == '1' )
164 chkUpnp.checked = true;
166 chkUpnp.checked = false;
171 // if protocol is Bridge or PPP IP extension
172 // then don't show DHCP info
173 if (proto == 'Bridge' || ipExt == '1')
177 // if any protocol has NAT enabled then
178 // don't show DHCP relay
179 if ( natEnbl == '1' ) {
181 if ( dhcpEnbl == '1' )
184 dhcpSrvType[0].checked = true;
189 if ( dhcpEnbl == '1' ) {
191 disableDhcpSrvRelay();
192 } else if ( dhcpEnbl == '2' ) {
193 enableDhcpSrvRelay();
196 dhcpSrvType[0].checked = true;
198 disableDhcpSrvRelay();
201 lan2IpAddress.value = '<%ejGet(lan2IpAddress)%>';
202 lan2SubnetMask.value = '<%ejGet(lan2SubnetMask)%>';
203 if ('<%ejGet(enblLan2)%>' == '1') {
204 enblLan2.checked = true;
207 enblLan2.checked = false;
212 chkStp.checked = true;
214 chkStp.checked = false;
218 function hideLan2Info(hide) {
219 var status = 'visible';
223 if (document.getElementById) // DOM3 = IE5, NS6
224 document.getElementById('lan2Info').style.visibility = status;
226 if (document.layers == false) // IE4
227 document.all.lan2Info.style.visibility = status;
231 function lan2CbClick(cb) {
232 if ( cb.checked == true )
238 function isEndGTEStart(EndIp, StartIp)
240 addrEnd = EndIp.split('.');
241 addrStart = StartIp.split('.');
242 E = parseInt(addrEnd[3]) + 1;
243 S = parseInt(addrStart[3]) + 1;
249 function btnApply(reboot) {
250 var loc = 'lancfg2.cgi?';
253 loc = 'lancfg2Reset.cgi?';
255 with ( document.forms[0] ) {
256 if ( isValidIpAddress(ethIpAddress.value) == false ) {
257 alert('Address "' + ethIpAddress.value + '" is invalid IP address.');
260 if ( isValidIpAddress(ethSubnetMask.value) == false ) {
261 alert('Subnet mask "' + ethSubnetMask.value + '" has invalid IP address.');
264 loc += 'ethIpAddress=' + ethIpAddress.value;
265 loc += 'ðSubnetMask=' + ethSubnetMask.value;
266 if ( buildUpnp == '1' ) {
267 if ( chkUpnp.checked == true )
268 loc += '&enblUpnp=1';
270 loc += '&enblUpnp=0';
272 if ( chkStp.checked == true )
277 if ( dhcpSrvType[1].checked == true ) {
278 if (isValidIpAddress(dhcpEthStart.value) == false ||
279 !(isSameSubNet(ethIpAddress.value, ethSubnetMask.value, dhcpEthStart.value, ethSubnetMask.value))) {
280 alert('Start IP address "' + dhcpEthStart.value + '" is invalid IP address.');
283 if ( isValidIpAddress(dhcpEthEnd.value) == false ||
284 !(isSameSubNet(ethIpAddress.value, ethSubnetMask.value, dhcpEthEnd.value, ethSubnetMask.value))) {
285 alert('End IP address "' + dhcpEthEnd.value + '" is invalid IP address.');
288 if (!(isEndGTEStart(dhcpEthEnd.value, dhcpEthStart.value))) {
289 alert("End ip has to be equal or greater than Start Ip address.");
292 if ( isNaN(dhcpLeasedTime.value) == true || dhcpLeasedTime.value <= 0) {
293 alert('Leased time "' + dhcpLeasedTime.value + '" is invalid.');
296 loc += '&dhcpEthStart=' + dhcpEthStart.value;
297 loc += '&dhcpEthEnd=' + dhcpEthEnd.value;
298 loc += '&dhcpLeasedTime=' + dhcpLeasedTime.value;
299 loc += '&enblDhcpSrv=1';
301 if ( natEnbl == '1' )
302 loc += '&enblDhcpSrv=0';
304 if ( dhcpSrvType[2].checked == true ) {
305 if ( isValidIpAddress(dhcpSrvAddr.value) == false ) {
306 alert('DHCP server IP address "' + dhcpSrvAddr.value + '" is invalid IP address.');
309 loc += '&dhcpEthStart=' + dhcpSrvAddr.value;
310 loc += '&enblDhcpSrv=2';
312 loc += '&enblDhcpSrv=0';
315 if (enblLan2.checked == true) {
316 if ( isValidIpAddress(lan2IpAddress.value) == false ) {
317 alert('Address "' + lan2IpAddress.value + '" is invalid IP address.');
320 if ( isValidIpAddress(lan2SubnetMask.value) == false ) {
321 alert('Subnet mask "' + lan2SubnetMask.value + '" has invalid IP address.');
324 if (ethIpAddress.value == lan2IpAddress.value) {
325 alert('The IP address "' + ethIpAddress.value + '" for both LAN interfaces should not be the same.');
328 if (isSameSubNet(ethIpAddress.value, ethSubnetMask.value, lan2IpAddress.value, lan2SubnetMask.value)) {
329 alert('The Subnet can not be the same for both LAN interfaces.');
332 loc += '&enblLan2=1';
333 loc += '&lan2IpAddress=' + lan2IpAddress.value;
334 loc += '&lan2SubnetMask=' + lan2SubnetMask.value;
337 loc += '&enblLan2=0';
339 var code = 'location.assign("' + loc + '")';
343 function btnReset() {
344 var loc = 'rebootinfo.cgi';
346 var code = 'location.assign("' + loc + '")';
350 function setDhcpAddresses(lanIp) {
351 with ( document.forms[0] ) {
352 if ( isValidIpAddress(lanIp) == false ) {
353 alert('Address "' + lanIp + '" is invalid IP address.');
356 addrParts = lanIp.split('.');
357 if ( addrParts.length != 4 )
359 t1 = parseInt(addrParts[3]) + 1;
360 if (dhcpEthStart.value != '' && t1 >= 255) {
361 alert("Last portion of IP Address has to be less than 254 for Enabled DHCP Server");
364 dhcpEthStart.value = dhcpEthEnd.value = "";
365 for (i = 0; i < 3; i++) {
366 dhcpEthStart.value = dhcpEthStart.value + addrParts[i] + ".";
367 dhcpEthEnd.value = dhcpEthEnd.value + addrParts[i] + ".";
369 dhcpEthStart.value = dhcpEthStart.value + t1;
370 dhcpEthEnd.value = dhcpEthEnd.value + 254;
377 <base target="_self">
380 <body onload="initMenu('idMenu'); frmLoad();">
382 <script type="text/javascript">
383 writeHeader("LAN", "<%ejGet(curUserName)%>", "<%ejGetOther(sysInfo, adslStd)%>", "<%ejGetOther(sysInfo, noBrPrtcl)%>", <%ejGetOther(sysInfo, pppIpExtension)%>, <%ejGetOther(sysInfo, enblFirewall)%>, <%ejGetOther(sysInfo, enblNat)%>, "<%ejGetWl(wlInterface)%>", <%ejGet(enblQos)%>);
389 <p>Configure the router’s IP address and subnet mask for LAN interface.</p>
391 <table border="0" cellpadding="1" cellspacing="0">
393 <td><label for="ethIpAddress">IP address:</label></td>
394 <td><input type='text' name='ethIpAddress' id='ethIpAddress'></td>
397 <td><label for="ethSubnetMask">Subnet mask:</label></td>
398 <td><input type='text' name='ethSubnetMask' id='ethSubnetMask'></td>
404 <input type='radio' name='dhcpSrvType' id='optDHCPoff' onClick='typeClick()'> <label for="optDHCPoff">Disable DHCP server</label><br>
405 <input type='radio' name='dhcpSrvType' id='optDHCPon' onClick='typeClick()'> <label for="optDHCPon">Enable DHCP server</label>
407 <table border="0" cellpadding="1" cellspacing="0" style="margin-left: 2em;">
409 <td><label for="dhcpEthStart">Start IP address:</label></td>
410 <td><input type='text' name='dhcpEthStart' id='dhcpEthStart' onChange='manualModDhcp()'></td>
413 <td><label for="dhcpEthEnd">End IP address:</label></td>
414 <td><input type='text' name='dhcpEthEnd' id='dhcpEthEnd' onChange='manualModDhcp()'></td>
417 <td><label for="dhcpLeasedTime">Lease time:</label></td>
418 <td><input type='text' name='dhcpLeasedTime' id='dhcpLeasedTime'> hours</td>
423 <p><input type='radio' name='dhcpSrvType' id='optDHCPrelay' onClick='typeClick()'> <label for="optDHCPrelay">Enable DHCP server relay</label></p>
424 <table border="0" cellpadding="1" cellspacing="0" style="margin-left: 2em;">
426 <td><label for="dhcpSrvAddr">DHCP server IP address:</label></td>
427 <td><input type='text' name='dhcpSrvAddr' id='dhcpSrvAddr'></td>
432 <p><input type='checkbox' name='enblLan2' id='enblLan2' onClick='lan2CbClick(this)'> <label for="enblLan2">Configure the second IP address and subnet mask for LAN interface</label></p>
434 <table border="0" cellpadding="1" cellspacing="0" style="margin-left: 2em;">
436 <td><label for="lan2IpAddress">IP address:</label></td>
437 <td><input type='text' name='lan2IpAddress' id='lan2IpAddress'></td>
440 <td><label for="lan2SubnetMask">Subnet mask:</label></td>
441 <td><input type='text' name='lan2SubnetMask' id='lan2SubnetMask'></td>
448 <h3>Universal Plug-n-Play</h3>
449 <p><input type='checkbox' name='chkUpnp' id='chkUpnp'> <label for="chkUpnp">Universal Plug-n-Play (UPnP)</label></p>
454 <p><input type='checkbox' name='chkStp' id='chkStp'> <label for="chkStp">802.1d spanning tree protocol</label></p>
457 <p><input type='button' onClick='btnApply(0)' value='Apply'> <input type='button' onClick='btnReset()' value='Restart'></p>
460 <script type="text/javascript">