3 <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
4 <link rel="stylesheet" href='stylemain.css' type='text/css'>
5 <link rel="stylesheet" href='colors.css' type='text/css'>
6 <script language="javascript" src="util.js"></script>
7 <script language="javascript">
9 var state = '<%ejGet(lanRefresh)%>';
11 var code = 'location="lancfg2.cgi?lanRefresh=0"';
15 var dhcpStart = '<%ejGet(dhcpEthStart)%>';
16 var dhcpEnd = '<%ejGet(dhcpEthEnd)%>';
17 var dhcpLease = '<%ejGet(dhcpLeasedTime)%>';
18 var proto = '<%ejGetOther(sysInfo, noBrPrtcl)%>';
19 var ipExt = '<%ejGetOther(sysInfo, pppIpExtension)%>';
20 var dhcpEnbl = '<%ejGet(enblDhcpSrv)%>';
21 var natEnbl = '<%ejGetOther(sysInfo, enblNat)%>';
22 var enblUpnp = '<%ejGet(enblUpnp)%>';
23 var enblIgmpSnp = '<%ejGet(enblIgmpSnp)%>';
24 var enblIgmpMode = '<%ejGet(enblIgmpMode)%>';
25 var buildUpnp = '<%ejGetOther(sysInfo, buildUpnp)%>';
27 function hideUpnpInfo(hide) {
28 var status = 'visible';
32 if (document.getElementById) // DOM3 = IE5, NS6
33 document.getElementById('upnpInfo').style.visibility = status;
35 if (document.layers == false) // IE4
36 document.all.upnpInfo.style.visibility = status;
40 function hideIgmpSnpInfo(hide) {
41 var status = 'visible';
45 if (document.getElementById) // DOM3 = IE5, NS6
46 document.getElementById('igmpSnpInfo').style.visibility = status;
48 if (document.layers == false) // IE4
49 document.all.igmpSnpInfo.style.visibility = status;
53 function hideDhcpInfo(hide) {
54 var status = 'visible';
58 if (document.getElementById) // DOM3 = IE5, NS6
59 document.getElementById('dhcpInfo').style.visibility = status;
61 if (document.layers == false) // IE4
62 document.all.dhcpInfo.style.visibility = status;
66 function disableDhcpSrv() {
67 with ( document.forms[0] ) {
68 dhcpSrvType[1].checked = false;
69 dhcpEthStart.disabled = 1;
70 dhcpEthEnd.disabled = 1;
71 dhcpLeasedTime.value = '';
72 dhcpLeasedTime.disabled = 1;
76 function enableDhcpSrv(formLoad) {
77 with ( document.forms[0] ) {
78 dhcpSrvType[1].checked = true;
79 dhcpEthStart.disabled = 0;
80 dhcpEthEnd.disabled = 0;
82 setDhcpAddresses(ethIpAddress.value);
84 dhcpEthStart.value = dhcpStart;
85 dhcpEthEnd.value = dhcpEnd;
87 dhcpLeasedTime.value = dhcpLease;
88 dhcpLeasedTime.disabled = 0;
92 function hideRelayInfo(hide) {
93 var status = 'visible';
97 if (document.getElementById) // DOM3 = IE5, NS6
98 document.getElementById('relayInfo').style.visibility = status;
100 if (document.layers == false) // IE4
101 document.all.relayInfo.style.visibility = status;
105 function disableDhcpSrvRelay() {
106 with ( document.forms[0] ) {
107 dhcpSrvType[2].checked = false;
108 dhcpSrvAddr.disabled = 1;
112 function enableDhcpSrvRelay() {
113 with ( document.forms[0] ) {
114 dhcpSrvType[2].checked = true;
115 if (dhcpEthStart.value != "")
116 dhcpSrvAddr.value = dhcpEthStart.value;
118 dhcpSrvAddr.value = dhcpStart;
119 dhcpSrvAddr.disabled = 0;
123 function typeClick() {
124 with ( document.forms[0] ) {
125 // if any protocol has NAT enabled then
126 // don't show DHCP relay
127 if ( natEnbl == '1' ) {
128 if ( dhcpSrvType[0].checked == true )
133 if ( dhcpSrvType[0].checked == true ) {
135 disableDhcpSrvRelay();
136 } else if ( dhcpSrvType[1].checked == true ) {
138 disableDhcpSrvRelay();
140 enableDhcpSrvRelay();
147 function igmpClick() {
151 with ( document.forms[0] ) {
152 ethIpAddress.value = '<%ejGet(ethIpAddress)%>';
153 ethSubnetMask.value = '<%ejGet(ethSubnetMask)%>';
155 if ( natEnbl == '1' && buildUpnp == '1' ) {
156 if ( enblUpnp == '1' )
157 chkUpnp.checked = true;
159 chkUpnp.checked = false;
164 if ( enblIgmpSnp == '1' )
165 chkIgmpSnp.checked = true;
167 chkIgmpSnp.checked = false;
168 if ( enblIgmpMode == '1' ) {
169 igmpMode[0].checked = false;
170 igmpMode[1].checked = true;
173 igmpMode[0].checked = true;
174 igmpMode[1].checked = false;
178 // if protocol is Bridge or PPP IP extension
179 // then don't show DHCP info
180 if (proto == 'Bridge' || ipExt == '1')
184 // if any protocol has NAT enabled then
185 // don't show DHCP relay
186 if ( natEnbl == '1' ) {
188 if ( dhcpEnbl == '1' )
191 dhcpSrvType[0].checked = true;
196 if ( dhcpEnbl == '1' ) {
198 disableDhcpSrvRelay();
199 } else if ( dhcpEnbl == '2' ) {
200 enableDhcpSrvRelay();
203 dhcpSrvType[0].checked = true;
205 disableDhcpSrvRelay();
208 lan2IpAddress.value = '<%ejGet(lan2IpAddress)%>';
209 lan2SubnetMask.value = '<%ejGet(lan2SubnetMask)%>';
210 if ('<%ejGet(enblLan2)%>' == '1') {
211 enblLan2.checked = true;
214 enblLan2.checked = false;
221 function hideLan2Info(hide) {
222 var status = 'visible';
226 if (document.getElementById) // DOM3 = IE5, NS6
227 document.getElementById('lan2Info').style.visibility = status;
229 if (document.layers == false) // IE4
230 document.all.lan2Info.style.visibility = status;
234 function lan2CbClick(cb) {
235 if ( cb.checked == true )
241 function isEndGTEStart(EndIp, StartIp)
243 addrEnd = EndIp.split('.');
244 addrStart = StartIp.split('.');
245 E = parseInt(addrEnd[3]) + 1;
246 S = parseInt(addrStart[3]) + 1;
252 function btnSave(reboot) {
253 var loc = 'lancfg2.cgi?';
256 loc = 'lancfg2Reset.cgi?';
258 with ( document.forms[0] ) {
259 if ( isValidIpAddress(ethIpAddress.value) == false ) {
260 alert('Address "' + ethIpAddress.value + '" is invalid IP address.');
263 if ( isValidIpAddress(ethSubnetMask.value) == false ) {
264 alert('Subnet mask "' + ethSubnetMask.value + '" has invalid IP address.');
267 loc += 'ethIpAddress=' + ethIpAddress.value;
268 loc += 'ðSubnetMask=' + ethSubnetMask.value;
269 if ( buildUpnp == '1' ) {
270 if ( chkUpnp.checked == true )
271 loc += '&enblUpnp=1';
273 loc += '&enblUpnp=0';
275 if ( chkIgmpSnp.checked == true )
276 loc += '&enblIgmpSnp=1';
278 loc += '&enblIgmpSnp=0';
279 if ( igmpMode[1].checked == true )
280 loc += '&enblIgmpMode=1';
282 loc += '&enblIgmpMode=0';
283 if ( dhcpSrvType[1].checked == true ) {
284 if (isValidIpAddress(dhcpEthStart.value) == false ||
285 !(isSameSubNet(ethIpAddress.value, ethSubnetMask.value, dhcpEthStart.value, ethSubnetMask.value))) {
286 alert('Start IP address "' + dhcpEthStart.value + '" is invalid IP address.');
289 if ( isValidIpAddress(dhcpEthEnd.value) == false ||
290 !(isSameSubNet(ethIpAddress.value, ethSubnetMask.value, dhcpEthEnd.value, ethSubnetMask.value))) {
291 alert('End IP address "' + dhcpEthEnd.value + '" is invalid IP address.');
294 if (!(isEndGTEStart(dhcpEthEnd.value, dhcpEthStart.value))) {
295 alert("End ip has to be equal or greater than Start Ip address.");
298 if ( isNaN(dhcpLeasedTime.value) == true || dhcpLeasedTime.value <= 0) {
299 alert('Leased time "' + dhcpLeasedTime.value + '" is invalid.');
302 loc += '&dhcpEthStart=' + dhcpEthStart.value;
303 loc += '&dhcpEthEnd=' + dhcpEthEnd.value;
304 loc += '&dhcpLeasedTime=' + dhcpLeasedTime.value;
305 loc += '&enblDhcpSrv=1';
307 if ( natEnbl == '1' )
308 loc += '&enblDhcpSrv=0';
310 if ( dhcpSrvType[2].checked == true ) {
311 if ( isValidIpAddress(dhcpSrvAddr.value) == false ) {
312 alert('DHCP server IP address "' + dhcpSrvAddr.value + '" is invalid IP address.');
315 loc += '&dhcpEthStart=' + dhcpSrvAddr.value;
316 loc += '&enblDhcpSrv=2';
318 loc += '&enblDhcpSrv=0';
321 if (enblLan2.checked == true) {
322 if ( isValidIpAddress(lan2IpAddress.value) == false ) {
323 alert('Address "' + lan2IpAddress.value + '" is invalid IP address.');
326 if ( isValidIpAddress(lan2SubnetMask.value) == false ) {
327 alert('Subnet mask "' + lan2SubnetMask.value + '" has invalid IP address.');
330 if (ethIpAddress.value == lan2IpAddress.value) {
331 alert('The IP address "' + ethIpAddress.value + '" for both LAN interfaces should not be the same.');
334 if (isSameSubNet(ethIpAddress.value, ethSubnetMask.value, lan2IpAddress.value, lan2SubnetMask.value)) {
335 alert('The Subnet can not be the same for both LAN interfaces.');
338 loc += '&enblLan2=1';
339 loc += '&lan2IpAddress=' + lan2IpAddress.value;
340 loc += '&lan2SubnetMask=' + lan2SubnetMask.value;
343 loc += '&enblLan2=0';
345 var code = 'location="' + 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;
378 <body onLoad='frmLoad()'>
381 <b>Local Area Network (LAN) Setup</b><br>
383 Configure the DSL Router IP Address and Subnet Mask for
384 LAN interface. Save button only saves the LAN configuration
385 data. Save/Reboot button saves the LAN configuration data and reboots the
386 router to make the new configuration effective.<br>
388 <table border="0" cellpadding="0" cellspacing="0">
390 <td width="150">IP Address:</td>
391 <td><input type='text' name='ethIpAddress' onChange='setDhcpAddresses(this.value)'></td>
394 <td>Subnet Mask:</td>
395 <td><input type='text' name='ethSubnetMask'></td>
400 <table border="0" cellpadding="0" cellspacing="0">
402 <td><input type='checkbox' name='chkUpnp'> Enable UPnP</td>
407 <div id='igmpSnpInfo'>
408 <table border="0" cellpadding="0" cellspacing="0">
410 <td><input type='checkbox' name='chkIgmpSnp' onClick='igmpClick(this)'> Enable IGMP Snooping</td>
412 <td colspan="2"><input type='radio' name='igmpMode'> Standard Mode</td>
415 <td colspan="2"><input type='radio' name='igmpMode'> Blocking Mode</td>
422 <table border="0" cellpadding="0" cellspacing="0">
424 <td colspan="2"><input type='radio' name='dhcpSrvType' onClick='typeClick()'> Disable DHCP Server</td>
427 <td colspan="2"><input type='radio' name='dhcpSrvType' onClick='typeClick()'> Enable DHCP Server</td>
430 <td> Start IP Address:</td>
431 <td><input type='text' name='dhcpEthStart'></td>
434 <td> End IP Address:</td>
435 <td><input type='text' name='dhcpEthEnd'></td>
438 <td> Leased Time (hour):</td>
439 <td><input type='text' name='dhcpLeasedTime'></td>
443 <table border="0" cellpadding="0" cellspacing="0">
445 <td colspan="2"><input type='radio' name='dhcpSrvType' onClick='typeClick()'> Enable DHCP Server Relay</td>
448 <td> DHCP Server IP Address: </td>
449 <td><input type='text' name='dhcpSrvAddr'></td>
454 <table border="0" cellpadding="0" cellspacing="0">
456 <td colspan="2"> </td>
459 <td colspan="2"><input type='checkbox' name='enblLan2' onClick='lan2CbClick(this)'>Configure the second IP Address and Subnet Mask for LAN interface
463 <table border="0" cellpadding="0" cellspacing="0">
465 <td width="150">IP Address:</td>
466 <td><input type='text' name='lan2IpAddress'></td>
469 <td>Subnet Mask:</td>
470 <td><input type='text' name='lan2SubnetMask'></td>
478 <input type='button' onClick='btnSave(0)' value='Save'> <input type='button' onClick='btnSave(1)' value='Save/Reboot'>