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 <link href="usr_menus.css" rel="stylesheet" type="text/css"><script src="usr_menus.js" type="text/javascript"></script><script src="usr_menus_build.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("<%ejGetWlJS(wlInterface)%>");
20 var state = '<%ejGetJS(lanRefresh)%>';
22 var code = 'location = "lancfg2.cgi?lanRefresh=0"';
26 var dhcpStart = '<%ejGetJS(dhcpEthStart)%>';
27 var dhcpEnd = '<%ejGetJS(dhcpEthEnd)%>';
28 var dhcpLease = '<%ejGetJS(dhcpLeasedTime)%>';
29 var proto = '<%ejGetOther(sysInfo, noBrPrtcl)%>';
30 var ipExt = '<%ejGetOther(sysInfo, pppIpExtension)%>';
31 var dhcpEnbl = '<%ejGetJS(enblDhcpSrv)%>';
32 var natEnbl = '<%ejGetOther(sysInfo, enblNat)%>';
33 var enblUpnp = '<%ejGetJS(enblUpnp)%>';
34 var enblIgmpSnp = '<%ejGetJS(enblIgmpSnp)%>';
35 var buildUpnp = '<%ejGetOther(sysInfo, buildUpnp)%>';
36 var enblStp = '<%ejGetJS(enblStp)%>';
38 function hideStpInfo(hide) {
39 var status = 'visible';
43 if (document.getElementById) // DOM3 = IE5, NS6
44 document.getElementById('idStp').style.visibility = status;
46 if (document.layers == false) // IE4
47 document.all.idStp.style.visibility = status;
51 function hideUpnpInfo(hide) {
52 var status = 'visible';
56 if (document.getElementById) // DOM3 = IE5, NS6
57 document.getElementById('upnpInfo').style.visibility = status;
59 if (document.layers == false) // IE4
60 document.all.upnpInfo.style.visibility = status;
64 function hideIgmpSnpInfo(hide) {
65 var status = 'visible';
69 if (document.getElementById) // DOM3 = IE5, NS6
70 document.getElementById('IGMPSnooping').style.visibility = status;
72 if (document.layers == false) // IE4
73 document.all.iIGMPSnooping.style.visibility = status;
77 function hideDhcpInfo(hide) {
78 var status = 'visible';
82 if (document.getElementById) // DOM3 = IE5, NS6
83 document.getElementById('dhcpInfo').style.visibility = status;
85 if (document.layers == false) // IE4
86 document.all.dhcpInfo.style.visibility = status;
90 function disableDhcpSrv() {
91 with ( document.forms[0] ) {
92 dhcpSrvType[1].checked = false;
93 dhcpEthStart.disabled = 1;
94 dhcpEthEnd.disabled = 1;
95 dhcpLeasedTime.value = '';
96 dhcpLeasedTime.disabled = 1;
100 function enableDhcpSrv(formLoad) {
101 with ( document.forms[0] ) {
102 dhcpSrvType[1].checked = true;
103 dhcpEthStart.disabled = 0;
104 dhcpEthEnd.disabled = 0;
106 setDhcpAddresses(ethIpAddress.value);
108 dhcpEthStart.value = dhcpStart;
109 dhcpEthEnd.value = dhcpEnd;
111 dhcpLeasedTime.value = dhcpLease;
112 dhcpLeasedTime.disabled = 0;
116 function hideRelayInfo(hide) {
117 var status = 'visible';
121 if (document.getElementById) // DOM3 = IE5, NS6
122 document.getElementById('relayInfo').style.visibility = status;
124 if (document.layers == false) // IE4
125 document.all.relayInfo.style.visibility = status;
129 function disableDhcpSrvRelay() {
130 with ( document.forms[0] ) {
131 dhcpSrvType[2].checked = false;
132 dhcpSrvAddr.disabled = 1;
136 function enableDhcpSrvRelay() {
137 with ( document.forms[0] ) {
138 dhcpSrvType[2].checked = true;
139 if (dhcpEthStart.value != "")
140 dhcpSrvAddr.value = dhcpEthStart.value;
142 dhcpSrvAddr.value = dhcpStart;
143 dhcpSrvAddr.disabled = 0;
147 function typeClick() {
148 with ( document.forms[0] ) {
149 // if any protocol has NAT enabled then
150 // don't show DHCP relay
151 if ( natEnbl == '1' ) {
152 if ( dhcpSrvType[0].checked == true )
157 if ( dhcpSrvType[0].checked == true ) {
159 disableDhcpSrvRelay();
160 } else if ( dhcpSrvType[1].checked == true ) {
162 disableDhcpSrvRelay();
164 enableDhcpSrvRelay();
172 with ( document.forms[0] ) {
173 ethIpAddress.value = '<%ejGetJS(ethIpAddress)%>';
174 ethSubnetMask.value = '<%ejGetJS(ethSubnetMask)%>';
176 if ( natEnbl == '1' && buildUpnp == '1' ) {
177 if ( enblUpnp == '1' )
178 chkUpnp.checked = true;
180 chkUpnp.checked = false;
185 if ( enblIgmpSnp == '1' )
186 chkIgmpSnp.checked = true;
188 chkIgmpSnp.checked = false;
192 // if protocol is Bridge or PPP IP extension
193 // then don't show DHCP info
194 if (proto == 'Bridge' || ipExt == '1')
198 // if any protocol has NAT enabled then
199 // don't show DHCP relay
200 if ( natEnbl == '1' ) {
202 if ( dhcpEnbl == '1' )
205 dhcpSrvType[0].checked = true;
210 if ( dhcpEnbl == '1' ) {
212 disableDhcpSrvRelay();
213 } else if ( dhcpEnbl == '2' ) {
214 enableDhcpSrvRelay();
217 dhcpSrvType[0].checked = true;
219 disableDhcpSrvRelay();
222 lan2IpAddress.value = '<%ejGetJS(lan2IpAddress)%>';
223 lan2SubnetMask.value = '<%ejGetJS(lan2SubnetMask)%>';
224 if ('<%ejGetJS(enblLan2)%>' == '1') {
225 enblLan2.checked = true;
228 enblLan2.checked = false;
233 chkStp.checked = true;
235 chkStp.checked = false;
239 function hideLan2Info(hide) {
240 var status = 'visible';
244 if (document.getElementById) // DOM3 = IE5, NS6
245 document.getElementById('lan2Info').style.visibility = status;
247 if (document.layers == false) // IE4
248 document.all.lan2Info.style.visibility = status;
252 function lan2CbClick(cb) {
253 if ( cb.checked == true )
259 function isEndGTEStart(EndIp, StartIp)
261 addrEnd = EndIp.split('.');
262 addrStart = StartIp.split('.');
263 E = parseInt(addrEnd[3]) + 1;
264 S = parseInt(addrStart[3]) + 1;
270 function btnApply(reboot) {
271 var loc = 'lancfg2.cgi?';
274 loc = 'lancfg2Reset.cgi?';
276 with ( document.forms[0] ) {
277 if ( isValidIpAddress(ethIpAddress.value) == false ) {
278 alert('Address "' + ethIpAddress.value + '" is invalid IP address.');
281 if ( isValidIpAddress(ethSubnetMask.value) == false ) {
282 alert('Subnet mask "' + ethSubnetMask.value + '" has invalid IP address.');
285 loc += 'ethIpAddress=' + ethIpAddress.value;
286 loc += 'ðSubnetMask=' + ethSubnetMask.value;
287 if ( buildUpnp == '1' ) {
288 if ( chkUpnp.checked == true )
289 loc += '&enblUpnp=1';
291 loc += '&enblUpnp=0';
293 if ( chkStp.checked == true )
298 if ( chkIgmpSnp.checked == true )
299 loc += '&enblIgmpSnp=1';
301 loc += '&enblIgmpSnp=0';
302 if ( dhcpSrvType[1].checked == true ) {
303 if (isValidIpAddress(dhcpEthStart.value) == false ||
304 !(isSameSubNet(ethIpAddress.value, ethSubnetMask.value, dhcpEthStart.value, ethSubnetMask.value))) {
305 alert('Start IP address "' + dhcpEthStart.value + '" is invalid IP address.');
308 if ( isValidIpAddress(dhcpEthEnd.value) == false ||
309 !(isSameSubNet(ethIpAddress.value, ethSubnetMask.value, dhcpEthEnd.value, ethSubnetMask.value))) {
310 alert('End IP address "' + dhcpEthEnd.value + '" is invalid IP address.');
313 if (!(isEndGTEStart(dhcpEthEnd.value, dhcpEthStart.value))) {
314 alert("End ip has to be equal or greater than Start Ip address.");
317 if ( isNaN(dhcpLeasedTime.value) == true || dhcpLeasedTime.value <= 0) {
318 alert('Leased time "' + dhcpLeasedTime.value + '" is invalid.');
321 loc += '&dhcpEthStart=' + dhcpEthStart.value;
322 loc += '&dhcpEthEnd=' + dhcpEthEnd.value;
323 loc += '&dhcpLeasedTime=' + dhcpLeasedTime.value;
324 loc += '&enblDhcpSrv=1';
326 if ( natEnbl == '1' )
327 loc += '&enblDhcpSrv=0';
329 if ( dhcpSrvType[2].checked == true ) {
330 if ( isValidIpAddress(dhcpSrvAddr.value) == false ) {
331 alert('DHCP server IP address "' + dhcpSrvAddr.value + '" is invalid IP address.');
334 loc += '&dhcpEthStart=' + dhcpSrvAddr.value;
335 loc += '&enblDhcpSrv=2';
337 loc += '&enblDhcpSrv=0';
340 if (enblLan2.checked == true) {
341 if ( isValidIpAddress(lan2IpAddress.value) == false ) {
342 alert('Address "' + lan2IpAddress.value + '" is invalid IP address.');
345 if ( isValidIpAddress(lan2SubnetMask.value) == false ) {
346 alert('Subnet mask "' + lan2SubnetMask.value + '" has invalid IP address.');
349 if (ethIpAddress.value == lan2IpAddress.value) {
350 alert('The IP address "' + ethIpAddress.value + '" for both LAN interfaces should not be the same.');
353 if (isSameSubNet(ethIpAddress.value, ethSubnetMask.value, lan2IpAddress.value, lan2SubnetMask.value)) {
354 alert('The Subnet can not be the same for both LAN interfaces.');
357 loc += '&enblLan2=1';
358 loc += '&lan2IpAddress=' + lan2IpAddress.value;
359 loc += '&lan2SubnetMask=' + lan2SubnetMask.value;
362 loc += '&enblLan2=0';
364 var code = 'location = "' + loc + '"';
368 function btnReset() {
369 var loc = 'rebootinfo.cgi';
371 var code = 'location = "' + loc + '"';
375 function setDhcpAddresses(lanIp) {
376 with ( document.forms[0] ) {
377 if ( isValidIpAddress(lanIp) == false ) {
378 alert('Address "' + lanIp + '" is invalid IP address.');
381 addrParts = lanIp.split('.');
382 if ( addrParts.length != 4 )
384 t1 = parseInt(addrParts[3]) + 1;
385 if (dhcpEthStart.value != '' && t1 >= 255) {
386 alert("Last portion of IP Address has to be less than 254 for Enabled DHCP Server");
389 dhcpEthStart.value = dhcpEthEnd.value = "";
390 for (i = 0; i < 3; i++) {
391 dhcpEthStart.value = dhcpEthStart.value + addrParts[i] + ".";
392 dhcpEthEnd.value = dhcpEthEnd.value + addrParts[i] + ".";
394 dhcpEthStart.value = dhcpEthStart.value + t1;
395 dhcpEthEnd.value = dhcpEthEnd.value + 254;
399 function manualModDhcp() {
400 with ( document.forms[0] ) {
401 dhcpStart = dhcpEthStart.value;
402 dhcpEnd = dhcpEthEnd.value;
408 <base target="_self">
411 <body onload="initMenu(); frmLoad();">
413 <script type="text/javascript">
420 <p>Configure the router’s IP address and subnet mask for LAN interface.</p>
422 <table border="0" cellpadding="1" cellspacing="0">
424 <td><label for="ethIpAddress">IP address:</label></td>
425 <td><input type='text' name='ethIpAddress' id='ethIpAddress'></td>
428 <td><label for="ethSubnetMask">Subnet mask:</label></td>
429 <td><input type='text' name='ethSubnetMask' id='ethSubnetMask'></td>
435 <input type='radio' name='dhcpSrvType' id='optDHCPoff' onClick='typeClick()'> <label for="optDHCPoff">Disable DHCP server</label><br>
436 <input type='radio' name='dhcpSrvType' id='optDHCPon' onClick='typeClick()'> <label for="optDHCPon">Enable DHCP server</label>
438 <table border="0" cellpadding="1" cellspacing="0" style="margin-left: 2em;">
440 <td><label for="dhcpEthStart">Start IP address:</label></td>
441 <td><input type='text' name='dhcpEthStart' id='dhcpEthStart' onChange='manualModDhcp()'></td>
444 <td><label for="dhcpEthEnd">End IP address:</label></td>
445 <td><input type='text' name='dhcpEthEnd' id='dhcpEthEnd' onChange='manualModDhcp()'></td>
448 <td><label for="dhcpLeasedTime">Lease time:</label></td>
449 <td><input type='text' name='dhcpLeasedTime' id='dhcpLeasedTime'> hours</td>
454 <p><input type='radio' name='dhcpSrvType' id='optDHCPrelay' onClick='typeClick()'> <label for="optDHCPrelay">Enable DHCP server relay</label></p>
455 <table border="0" cellpadding="1" cellspacing="0" style="margin-left: 2em;">
457 <td><label for="dhcpSrvAddr">DHCP server IP address:</label></td>
458 <td><input type='text' name='dhcpSrvAddr' id='dhcpSrvAddr'></td>
463 <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>
465 <table border="0" cellpadding="1" cellspacing="0" style="margin-left: 2em;">
467 <td><label for="lan2IpAddress">IP address:</label></td>
468 <td><input type='text' name='lan2IpAddress' id='lan2IpAddress'></td>
471 <td><label for="lan2SubnetMask">Subnet mask:</label></td>
472 <td><input type='text' name='lan2SubnetMask' id='lan2SubnetMask'></td>
478 <div id='IGMPSnooping'>
479 <h3>IGMP Snooping</h3>
480 <p><input type='checkbox' name='chkIgmpSnp' id='chkIgmpSnp'> <label for="chkIgmpSnp">IGMP Snooping</label></p>
484 <h3>Universal Plug-n-Play</h3>
485 <p><input type='checkbox' name='chkUpnp' id='chkUpnp'> <label for="chkUpnp">Universal Plug-n-Play (UPnP)</label></p>
490 <p><input type='checkbox' name='chkStp' id='chkStp'> <label for="chkStp">802.1d spanning tree protocol</label></p>
493 <p><input type='button' onClick='btnApply(0)' value='Apply'> <input type='button' onClick='btnReset()' value='Restart'></p>
496 <script type="text/javascript">