1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
12 <meta http-equiv='content-type' content='text/html;charset=utf-
8'
>
13 <meta name='robots' content='noindex,nofollow'
>
14 <title>[<%
ident(); %>] Advanced: DHCP / DNS
</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'
>
17 <script type='text/javascript' src='tomato.js'
></script>
21 <style type='text/css'
>
28 <script type='text/javascript' src='debug.js'
></script>
30 <script type='text/javascript'
>
32 // <% nvram("dnsmasq_q,ipv6_radvd,dhcpd_dmdns,dns_addget,dhcpd_gwmode,dns_intcpt,dhcpd_slt,dhcpc_minpkt,dnsmasq_custom,dnsmasq_norw,dhcpd_lmax,dhcpc_custom,dns_norebind,dhcpd_static_only"); %>
34 if ((isNaN(nvram
.dhcpd_lmax
)) || ((nvram
.dhcpd_lmax
*= 1) < 1)) nvram
.dhcpd_lmax
= 255;
36 function verifyFields(focused
, quiet
)
38 var b
= (E('_f_dhcpd_sltsel').value
== 1);
39 elem
.display('_dhcpd_sltman', b
);
40 if ((b
) && (!v_range('_f_dhcpd_slt', quiet
, 1, 43200))) return 0;
41 if (!v_length('_dnsmasq_custom', quiet
, 0, 2048)) return 0;
42 if (!v_range('_dhcpd_lmax', quiet
, 1, 0xFFFF)) return 0;
43 if (!v_length('_dhcpc_custom', quiet
, 0, 80)) return 0;
49 return (a
== null || (a
+ '').trim() == '') ? b
: a
;
54 if (!verifyFields(null, false)) return;
59 fom
.dhcpd_dmdns
.value
= E('_f_dhcpd_dmdns').checked
? 1 : 0;
60 a
= E('_f_dhcpd_sltsel').value
;
61 fom
.dhcpd_slt
.value
= (a
!= 1) ? a
: E('_f_dhcpd_slt').value
;
62 fom
.dns_addget
.value
= E('_f_dns_addget').checked
? 1 : 0;
63 fom
.dns_norebind
.value
= E('_f_dns_norebind').checked
? 1 : 0;
64 fom
.dhcpd_gwmode
.value
= E('_f_dhcpd_gwmode').checked
? 1 : 0;
65 fom
.dns_intcpt
.value
= E('_f_dns_intcpt').checked
? 1 : 0;
66 fom
.dhcpc_minpkt
.value
= E('_f_dhcpc_minpkt').checked
? 1 : 0;
67 fom
.dhcpd_static_only
.value
= E('_f_dhcpd_static_only').checked
? '1' : '0';
68 fom
.ipv6_radvd
.value
= E('_f_ipv6_radvd').checked
? '1' : '0';
70 fom
.dnsmasq_q
.value
= 0;
71 if (fom
.f_dnsmasq_q4
.checked
) fom
.dnsmasq_q
.value
|= 1;
72 if (fom
.f_dnsmasq_q6
.checked
) fom
.dnsmasq_q
.value
|= 2;
73 if (fom
.f_dnsmasq_qr
.checked
) fom
.dnsmasq_q
.value
|= 4;
75 if (fom
.dhcpc_minpkt
.value
!= nvram
.dhcpc_minpkt
||
76 fom
.dhcpc_custom
.value
!= nvram
.dhcpc_custom
) {
77 nvram
.dhcpc_minpkt
= fom
.dhcpc_minpkt
.value
;
78 nvram
.dhcpc_custom
= fom
.dhcpc_custom
.value
;
79 fom
._service
.value
= '*';
82 fom
._service
.value
= 'dnsmasq-restart';
86 if (fom
.dns_intcpt
.value
!= nvram
.dns_intcpt
) {
87 nvram
.dns_intcpt
= fom
.dns_intcpt
.value
;
88 if (fom
._service
.value
!= '*') fom
._service
.value
+= ',firewall-restart';
92 if (fom
.dhcpd_dmdns
.value
!= nvram
.dhcpd_dmdns
) {
93 nvram
.dhcpd_dmdns
= fom
.dhcpd_dmdns
.value
;
94 if (fom
._service
.value
!= '*') fom
._service
.value
+= ',dnsmasq-restart';
101 function toggleVisibility(whichone
) {
102 if(E('sesdiv' + whichone
).style
.display
=='') {
103 E('sesdiv' + whichone
).style
.display
='none';
104 E('sesdiv' + whichone
+ 'showhide').innerHTML
='(Click here to show)';
105 cookie
.set('adv_dhcpdns_' + whichone
+ '_vis', 0);
107 E('sesdiv' + whichone
).style
.display
='';
108 E('sesdiv' + whichone
+ 'showhide').innerHTML
='(Click here to hide)';
109 cookie
.set('adv_dhcpdns_' + whichone
+ '_vis', 1);
115 if (((c
= cookie
.get('adv_dhcpdns_notes_vis')) != null) && (c
== '1')) {
116 toggleVisibility("notes");
122 <body onload='init()'
>
123 <form id='_fom' method='post' action='tomato.cgi'
>
124 <table id='container' cellspacing=
0>
125 <tr><td colspan=
2 id='header'
>
126 <div class='title'
>Tomato
</div>
127 <div class='version'
>Version <%
version(); %></div>
129 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
131 <div id='ident'
><%
ident(); %></div>
135 <input type='hidden' name='_nextpage' value='advanced-dhcpdns.asp'
>
136 <input type='hidden' name='_service' value=''
>
138 <input type='hidden' name='dhcpd_dmdns'
>
139 <input type='hidden' name='dhcpd_slt'
>
140 <input type='hidden' name='dns_addget'
>
141 <input type='hidden' name='dns_norebind'
>
142 <input type='hidden' name='dhcpd_gwmode'
>
143 <input type='hidden' name='dns_intcpt'
>
144 <input type='hidden' name='dhcpc_minpkt'
>
145 <input type='hidden' name='dhcpd_static_only'
>
146 <input type='hidden' name='ipv6_radvd'
>
147 <input type='hidden' name='dnsmasq_q'
>
149 <div class='section-title'
>DHCP / DNS Server (LAN)
</div>
150 <div class='section'
>
151 <script type='text/javascript'
>
152 createFieldTable('', [
153 { title
: 'Use internal DNS', name
: 'f_dhcpd_dmdns', type
: 'checkbox', value
: nvram
.dhcpd_dmdns
== '1' },
154 { title
: 'Use received DNS with user-entered DNS', name
: 'f_dns_addget', type
: 'checkbox', value
: nvram
.dns_addget
== '1' },
155 { title
: 'Prevent DNS-rebind attacks', name
: 'f_dns_norebind', type
: 'checkbox', value
: nvram
.dns_norebind
== '1' },
156 { title
: 'Intercept DNS port<br>(UDP 53)', name
: 'f_dns_intcpt', type
: 'checkbox', value
: nvram
.dns_intcpt
== '1' },
157 { title
: 'Use user-entered gateway if WAN is disabled', name
: 'f_dhcpd_gwmode', type
: 'checkbox', value
: nvram
.dhcpd_gwmode
== '1' },
158 { title
: 'Ignore DHCP requests from unknown devices', name
: 'f_dhcpd_static_only', type
: 'checkbox', value
: nvram
.dhcpd_static_only
== '1' },
159 { title
: 'Maximum active DHCP leases', name
: 'dhcpd_lmax', type
: 'text', maxlen
: 5, size
: 8, value
: nvram
.dhcpd_lmax
},
160 { title
: 'Static lease time', multi
: [
161 { name
: 'f_dhcpd_sltsel', type
: 'select', options
: [[0,'Same as normal lease time'],[-1,'"Infinite"'],[1,'Custom']],
162 value
: (nvram
.dhcpd_slt
< 1) ? nvram
.dhcpd_slt
: 1 },
163 { name
: 'f_dhcpd_slt', type
: 'text', maxlen
: 5, size
: 8, prefix
: '<span id="_dhcpd_sltman"> ', suffix
: ' <i>(minutes)</i></span>',
164 value
: (nvram
.dhcpd_slt
>= 1) ? nvram
.dhcpd_slt
: 3600 } ] },
165 { title
: 'Announce IPv6 on LAN', name
: 'f_ipv6_radvd', type
: 'checkbox', value
: nvram
.ipv6_radvd
== '1' },
166 { title
: 'Mute dhcpv4 logging', name
: 'f_dnsmasq_q4', type
: 'checkbox', value
: (nvram
.dnsmasq_q
& 1) },
167 { title
: 'Mute dhcpv6 logging', name
: 'f_dnsmasq_q6', type
: 'checkbox', value
: (nvram
.dnsmasq_q
& 2) },
168 { title
: 'Mute RA logging', name
: 'f_dnsmasq_qr', type
: 'checkbox', value
: (nvram
.dnsmasq_q
& 4) },
169 { title
: '<a href="http://www.thekelleys.org.uk/" target="_new">Dnsmasq</a><br>Custom configuration', name
: 'dnsmasq_custom', type
: 'textarea', value
: nvram
.dnsmasq_custom
}
175 <div class='section-title'
>DHCP Client (WAN)
</div>
176 <div class='section'
>
177 <script type='text/javascript'
>
178 createFieldTable('', [
179 { title
: 'DHCPC Options', name
: 'dhcpc_custom', type
: 'text', maxlen
: 80, size
: 34, value
: nvram
.dhcpc_custom
},
180 { title
: 'Reduce packet size', name
: 'f_dhcpc_minpkt', type
: 'checkbox', value
: nvram
.dhcpc_minpkt
== '1' }
187 <div class='section-title'
>Notes
<small><i><a href='javascript:toggleVisibility(
"notes");'
><span id='sesdivnotesshowhide'
>(Click here to show)
</span></a></i></small></div>
188 <div class='section' id='sesdivnotes' style='display:none'
>
190 <i>DHCP / DNS Server (LAN):
</i><br>
192 <li><b>Use internal DNS
</b> - Allow dnsmasq to be your DNS server on LAN.
</li>
193 <li><b>Use received DNS with user-entered DNS
</b> - Add DNS servers received from your WAN connection to the static DNS server list (see
<a href='basic-network.asp'
>Network
</a> configuration).
</li>
194 <li><b>Prevent DNS-rebind attacks
</b> - Enable DNS rebinding protection on Dnsmasq.
</li>
195 <li><b>Intercept DNS port
</b> - Any DNS requests/packets sent out to UDP port
53 are redirected to the internal DNS server.
</li>
196 <li><b>Use user-entered gateway if WAN is disabled
</b> - DHCP will use the IP address of the router as the default gateway on each LAN.
</li>
197 <li><b>Ignore DHCP requests (...)
</b> - Dnsmasq will ignore DHCP requests to Only MAC addresses listed on the
<a href='basic-static.asp'
>Static DHCP/ARP
</a> page won't be able to obtain an IP address through DHCP.
</li>
198 <li><b>Maximum active DHCP leases
</b> - Self-explanatory.
</li>
199 <li><b>Static lease time
</b> - Absolute maximum amount of time allowed for any DHCP lease to be valid.
</li>
200 <li><b>Custom configuration
</b> - Extra options to be added to the Dnsmasq configuration file.
</li>
203 <i>DHCP Client (WAN):
</i><br>
205 <li><b>DHCPC Options
</b> - Extra options for the DHCP client.
</li>
206 <li><b>Reduce packet size
</b> - Self-explanatory.
</li>
209 <i>Other relevant notes/hints:
</i><br>
211 <li>The contents of file /etc/dnsmasq.custom are also added to the end of Dnsmasq's configuration file (if it exists).
</li>
219 <tr><td id='footer' colspan=
2>
220 <span id='footer-msg'
></span>
221 <input type='button' value='Save' id='save-button' onclick='save()'
>
222 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'
>
226 <script type='text/javascript'
>verifyFields(null, true);</script>