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(); %>] Basic: IPv6
</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'
>
16 <link rel='stylesheet' type='text/css' href='color.css'
>
17 <script type='text/javascript' src='tomato.js'
></script>
21 <script type='text/javascript' src='debug.js'
></script>
23 <script type='text/javascript'
>
24 // <% nvram("ipv6_6rd_prefix_length,ipv6_prefix,ipv6_prefix_length,ipv6_accept_ra,ipv6_isp_opt,ipv6_rtr_addr,ipv6_service,ipv6_dns,ipv6_tun_addr,ipv6_tun_addrlen,ipv6_ifname,ipv6_tun_v4end,ipv6_relay,ipv6_tun_mtu,ipv6_tun_ttl,ipv6_6rd_ipv4masklen,ipv6_6rd_prefix,ipv6_6rd_borderrelay,lan1_ifname,lan2_ifname,lan3_ifname,ipv6_vlan"); %>
26 nvram
.ipv6_accept_ra
= fixInt(nvram
.ipv6_accept_ra
, 0, 3, 0);
28 function verifyFields(focused
, quiet
)
39 _f_ipv6_prefix_length
: 1,
40 _f_ipv6_rtr_addr_auto
: 1,
45 _f_ipv6_accept_ra_wan
: 1,
46 _f_ipv6_accept_ra_lan
: 1,
55 _ipv6_6rd_ipv4masklen
: 1,
56 _ipv6_6rd_prefix_length
: 1,
58 _ipv6_6rd_borderrelay
: 1,
64 c
= E('_ipv6_service').value
;
68 vis
._f_ipv6_rtr_addr_auto
= 0;
69 vis
._f_ipv6_rtr_addr
= 0;
70 vis
._f_ipv6_dns_1
= 0;
71 vis
._f_ipv6_dns_2
= 0;
72 vis
._f_ipv6_dns_3
= 0;
73 vis
._f_ipv6_accept_ra_wan
= 0;
74 vis
._f_ipv6_accept_ra_lan
= 0;
75 vis
._f_ipv6_isp_opt
= 0;
78 vis
._ipv6_6rd_ipv4masklen
= 0;
79 vis
._ipv6_6rd_prefix_length
= 0;
80 vis
._ipv6_6rd_prefix
= 0;
81 vis
._ipv6_6rd_borderrelay
= 0;
82 vis
._f_ipv6_prefix
= 0;
83 vis
._f_ipv6_prefix_length
= 0;
84 vis
._ipv6_tun_v4end
= 0;
86 vis
._ipv6_tun_addr
= 0;
87 vis
._ipv6_tun_addrlen
= 0;
88 vis
._ipv6_tun_ttl
= 0;
89 vis
._ipv6_tun_mtu
= 0;
90 vis
._f_ipv6_isp_opt
= 0;
92 E('_f_ipv6_rtr_addr_auto').value
= 1;
93 vis
._f_ipv6_rtr_addr_auto
= 2;
97 vis
._f_ipv6_prefix
= 0;
98 vis
._ipv6_tun_v4end
= 0;
100 vis
._ipv6_tun_addr
= 0;
101 vis
._ipv6_tun_addrlen
= 0;
102 vis
._ipv6_ifname
= 0;
104 vis
._f_ipv6_accept_ra_wan
= 0;
105 vis
._f_ipv6_accept_ra_lan
= 0;
106 vis
._f_ipv6_rtr_addr_auto
= 0;
107 vis
._f_ipv6_rtr_addr
= 0;
108 vis
._f_ipv6_prefix_length
= 0;
111 _fom
.f_ipv6_accept_ra_wan
.checked
= true;
113 vis
._f_ipv6_prefix
= 0;
114 vis
._f_ipv6_rtr_addr_auto
= 0;
115 vis
._f_ipv6_rtr_addr
= 0;
117 vis
._f_ipv6_prefix_length
= 0;
118 vis
._f_ipv6_accept_ra_lan
= 0;
119 vis
._f_ipv6_accept_ra_wan
= 0;
120 vis
._f_ipv6_isp_opt
= 0;
124 vis
._ipv6_ifname
= 0;
125 vis
._ipv6_tun_v4end
= 0;
127 vis
._ipv6_tun_addr
= 0;
128 vis
._ipv6_tun_addrlen
= 0;
129 vis
._ipv6_tun_ttl
= 0;
130 vis
._ipv6_tun_mtu
= 0;
131 vis
._ipv6_6rd_ipv4masklen
= 0;
132 vis
._ipv6_6rd_prefix_length
= 0;
133 vis
._ipv6_6rd_prefix
= 0;
134 vis
._ipv6_6rd_borderrelay
= 0;
136 if (nvram
.lan1_ifname
== 'br1' && E('_f_ipv6_prefix_length').value
<= 63){ //2 ipv6 /64 networks
137 vis
._f_lan1_ipv6
= 1;}
138 if (nvram
.lan2_ifname
== 'br2' && E('_f_ipv6_prefix_length').value
<= 62){ //4 ipv6 /64 networks
139 vis
._f_lan2_ipv6
= 1;}
140 if (nvram
.lan3_ifname
== 'br3' && E('_f_ipv6_prefix_length').value
<= 62){
141 vis
._f_lan3_ipv6
= 1;}
145 vis
._ipv6_ifname
= 0;
146 vis
._f_ipv6_prefix
= 0;
147 vis
._f_ipv6_rtr_addr_auto
= 0;
148 vis
._f_ipv6_rtr_addr
= 0;
149 vis
._ipv6_tun_v4end
= 0;
150 vis
._ipv6_tun_addr
= 0;
151 vis
._ipv6_tun_addrlen
= 0;
152 vis
._f_ipv6_accept_ra_wan
= 0;
153 vis
._f_ipv6_accept_ra_lan
= 0;
154 vis
._f_ipv6_isp_opt
= 0;
155 vis
._ipv6_6rd_ipv4masklen
= 0;
156 vis
._ipv6_6rd_prefix_length
= 0;
157 vis
._ipv6_6rd_prefix
= 0;
158 vis
._ipv6_6rd_borderrelay
= 0;
161 vis
._ipv6_ifname
= 0;
163 vis
._f_ipv6_accept_ra_wan
= 0;
164 vis
._f_ipv6_accept_ra_lan
= 0;
165 vis
._f_ipv6_isp_opt
= 0;
166 vis
._ipv6_6rd_ipv4masklen
= 0;
167 vis
._ipv6_6rd_prefix_length
= 0;
168 vis
._ipv6_6rd_prefix
= 0;
169 vis
._ipv6_6rd_borderrelay
= 0;
173 if (vis
._f_ipv6_rtr_addr_auto
&& E('_f_ipv6_rtr_addr_auto').value
== 0) {
174 vis
._f_ipv6_rtr_addr
= 2;
181 b
.disabled
= (c
!= 1);
182 PR(b
).style
.display
= c
? '' : 'none';
187 if (vis
._ipv6_ifname
== 1) {
188 if (E('_ipv6_service').value
!= 'other') {
189 if (!v_length('_ipv6_ifname', quiet
|| !ok
, 2)) ok
= 0;
191 else ferror
.clear('_ipv6_ifname');
196 a = [['_ipv6_ifname', 2]];
197 for (i = a.length - 1; i >= 0; --i) {
199 if ((vis[v[0]]) && (!v_length(v[0], quiet || !ok, v[1]))) ok = 0;
204 a
= ['_ipv6_tun_v4end'];
205 for (i
= a
.length
- 1; i
>= 0; --i
)
206 if ((vis
[a
[i
]]) && (!v_ip(a
[i
], quiet
|| !ok
))) ok
= 0;
208 a
= ['_ipv6_6rd_borderrelay'];
209 for (i
= a
.length
- 1; i
>= 0; --i
)
210 if ((vis
[a
[i
]]) && (!v_ip(a
[i
], quiet
|| !ok
))) ok
= 0;
213 a
= [['_f_ipv6_prefix_length', 3, 64], ['_ipv6_tun_addrlen', 3, 127], ['_ipv6_tun_ttl', 0, 255], ['_ipv6_relay', 1, 254]];
214 for (i
= a
.length
- 1; i
>= 0; --i
) {
216 if ((vis
[b
[0]]) && (!v_range(b
[0], quiet
|| !ok
, b
[1], b
[2]))) ok
= 0;
222 if ((!v_range(b
, 1, 0, 0)) && (!v_range(b
, quiet
|| !ok
, 1280, 1480))) ok
= 0;
223 else ferror
.clear(E(b
));
227 b
= '_f_ipv6_prefix';
228 c
= vis
._f_ipv6_accept_ra_wan
&& (E('_f_ipv6_accept_ra_wan').checked
|| E('_f_ipv6_accept_ra_lan').checked
);
229 if (vis
[b
] && (E(b
).value
.length
> 0 || (!c
))) {
230 if (!v_ipv6_addr(b
, quiet
|| !ok
)) ok
= 0;
232 else ferror
.clear(b
);
235 a
= ['_ipv6_tun_addr'];
236 for (i
= a
.length
- 1; i
>= 0; --i
)
237 if ((vis
[a
[i
]]) && (!v_ipv6_addr(a
[i
], quiet
|| !ok
))) ok
= 0;
239 if (vis
._f_ipv6_rtr_addr
== 2) {
240 b
= E('_f_ipv6_prefix');
241 ip
= (b
.value
.length
> 0) ? ZeroIPv6PrefixBits(b
.value
, E('_f_ipv6_prefix_length').value
) : '';
242 b
.value
= CompressIPv6Address(ip
);
243 E('_f_ipv6_rtr_addr').value
= (ip
.length
> 0) ? CompressIPv6Address(ip
+ '1') : '';
246 // optional IPv6 address
247 a
= ['_f_ipv6_rtr_addr', '_f_ipv6_dns_1', '_f_ipv6_dns_2', '_f_ipv6_dns_3'];
248 for (i
= a
.length
- 1; i
>= 0; --i
)
249 if ((vis
[a
[i
]]==1) && (E(a
[i
]).value
.length
> 0) && (!v_ipv6_addr(a
[i
], quiet
|| !ok
))) ok
= 0;
256 verifyFields(null, 1);
259 function joinIPv6Addr(a
) {
263 for (i
= 0; i
< a
.length
; ++i
) {
264 s
= CompressIPv6Address(a
[i
]);
265 if ((s
) && (s
!= '')) r
.push(s
);
275 if (!verifyFields(null, false)) return;
279 fom
.ipv6_dns
.value
= joinIPv6Addr([fom
.f_ipv6_dns_1
.value
, fom
.f_ipv6_dns_2
.value
, fom
.f_ipv6_dns_3
.value
]);
280 fom
.ipv6_isp_opt
.value
= fom
.f_ipv6_isp_opt
.checked
? 1 : 0;
281 fom
.ipv6_accept_ra
.value
= 0;
282 if (fom
.f_ipv6_accept_ra_wan
.checked
&& !fom
.f_ipv6_accept_ra_wan
.disabled
)
283 fom
.ipv6_accept_ra
.value
|= 1;
284 if (fom
.f_ipv6_accept_ra_lan
.checked
&& !fom
.f_ipv6_accept_ra_lan
.disabled
)
285 fom
.ipv6_accept_ra
.value
|= 2;
287 fom
.ipv6_prefix_length
.value
= fom
.f_ipv6_prefix_length
.value
;
288 fom
.ipv6_prefix
.value
= fom
.f_ipv6_prefix
.value
;
289 fom
.ipv6_vlan
.value
= 0;
291 switch(E('_ipv6_service').value
) {
293 fom
.ipv6_prefix_length
.value
= 64;
294 fom
.ipv6_prefix
.value
= '';
295 fom
.ipv6_rtr_addr
.value
= fom
.f_ipv6_rtr_addr
.value
;
300 fom
.ipv6_prefix
.value
= '';
301 fom
.ipv6_rtr_addr
.value
= '';
304 fom
.ipv6_prefix
.value
= '';
305 fom
.ipv6_rtr_addr
.value
= '';
306 if (fom
.f_lan1_ipv6
.checked
)
307 fom
.ipv6_vlan
.value
|= 1;
308 if (fom
.f_lan2_ipv6
.checked
)
309 fom
.ipv6_vlan
.value
|= 2;
310 if (fom
.f_lan3_ipv6
.checked
)
311 fom
.ipv6_vlan
.value
|= 4;
314 fom
.ipv6_rtr_addr
.disabled
= fom
.f_ipv6_rtr_addr_auto
.disabled
;
315 if (fom
.f_ipv6_rtr_addr_auto
.value
== 1)
316 fom
.ipv6_rtr_addr
.value
= fom
.f_ipv6_rtr_addr
.value
;
318 fom
.ipv6_rtr_addr
.value
= '';
329 <form id='_fom' method='post' action='tomato.cgi'
>
330 <table id='container' cellspacing=
0>
331 <tr><td colspan=
2 id='header'
>
332 <div class='title'
>Tomato
</div>
333 <div class='version'
>Version <%
version(); %></div>
335 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
337 <div id='ident'
><%
ident(); %></div>
341 <input type='hidden' name='_nextpage' value='basic-ipv6.asp'
>
342 <input type='hidden' name='_nextwait' value='
10'
>
343 <input type='hidden' name='_service' value='*'
>
345 <input type='hidden' name='ipv6_dns'
>
346 <input type='hidden' name='ipv6_prefix'
>
347 <input type='hidden' name='ipv6_prefix_length'
>
348 <input type='hidden' name='ipv6_rtr_addr'
>
349 <input type='hidden' name='ipv6_accept_ra'
>
350 <input type='hidden' name='ipv6_vlan'
>
351 <input type='hidden' name='ipv6_isp_opt'
>
353 <div class='section-title'
>IPv6 Configuration
</div>
354 <div class='section'
>
355 <script type='text/javascript'
>
356 dns
= nvram
.ipv6_dns
.split(/\s+/);
358 createFieldTable('', [
359 { title
: 'IPv6 Service Type', name
: 'ipv6_service', type
: 'select',
360 options
: [['', 'Disabled'],['native','Native IPv6 from ISP'],['native-pd','DHCPv6 with Prefix Delegation'],['6to4','6to4 Anycast Relay'],['sit','6in4 Static Tunnel'],['6rd','6rd Relay'],['6rd-pd','6rd from DHCPv4 (Option 212)'],['other','Other (Manual Configuration)']],
361 value
: nvram
.ipv6_service
},
362 { title
: 'IPv6 WAN Interface', name
: 'ipv6_ifname', type
: 'text', maxlen
: 8, size
: 10, value
: nvram
.ipv6_ifname
},
364 { title
: 'Assigned / Routed Prefix', name
: 'f_ipv6_prefix', type
: 'text', maxlen
: 46, size
: 48, value
: nvram
.ipv6_prefix
},
365 { title
: '6rd Routed Prefix', name
: 'ipv6_6rd_prefix', type
: 'text', maxlen
: 46, size
: 48, value
: nvram
.ipv6_6rd_prefix
},
366 { title
: '6rd Prefix Length', name
: 'ipv6_6rd_prefix_length', type
: 'text', maxlen
: 3, size
: 5, value
: nvram
.ipv6_6rd_prefix_length
, suffix
: ' <small>(Usually 32)</small>' },
367 { title
: 'Prefix Length', name
: 'f_ipv6_prefix_length', type
: 'text', maxlen
: 3, size
: 5, value
: nvram
.ipv6_prefix_length
},
368 { title
: 'Router IPv6 Address', multi
: [
369 { name
: 'f_ipv6_rtr_addr_auto', type
: 'select', options
: [['0', 'Default'],['1','Manual']], value
: (nvram
.ipv6_rtr_addr
== '' ? '0' : '1') },
370 { name
: 'f_ipv6_rtr_addr', type
: 'text', maxlen
: 46, size
: 48, value
: nvram
.ipv6_rtr_addr
}
372 { title
: 'Static DNS', name
: 'f_ipv6_dns_1', type
: 'text', maxlen
: 46, size
: 48, value
: dns
[0] || '' },
373 { title
: '', name
: 'f_ipv6_dns_2', type
: 'text', maxlen
: 46, size
: 48, value
: dns
[1] || '' },
374 { title
: '', name
: 'f_ipv6_dns_3', type
: 'text', maxlen
: 46, size
: 48, value
: dns
[2] || '' },
375 { title
: 'Accept RA from', multi
: [
376 { suffix
: ' WAN ', name
: 'f_ipv6_accept_ra_wan', type
: 'checkbox', value
: (nvram
.ipv6_accept_ra
& 1) },
377 { suffix
: ' LAN ', name
: 'f_ipv6_accept_ra_lan', type
: 'checkbox', value
: (nvram
.ipv6_accept_ra
& 2) }
379 { title
: 'Other ISP Config.', name
: 'f_ipv6_isp_opt', type
: 'checkbox', value
: (nvram
.ipv6_isp_opt
!= '0') },
381 { title
: 'Tunnel Remote Endpoint (IPv4 Address)', name
: 'ipv6_tun_v4end', type
: 'text', maxlen
: 15, size
: 17, value
: nvram
.ipv6_tun_v4end
},
382 { title
: '6RD Tunnel Border Relay (IPv4 Address)', name
: 'ipv6_6rd_borderrelay', type
: 'text', maxlen
: 15, size
: 17, value
: nvram
.ipv6_6rd_borderrelay
},
383 { title
: '6RD IPv4 Mask Length', name
: 'ipv6_6rd_ipv4masklen', type
: 'text', maxlen
: 3, size
: 5, value
: nvram
.ipv6_6rd_ipv4masklen
, suffix
: ' <small>(usually 0)</small>' },
384 { title
: 'Relay Anycast Address', name
: 'ipv6_relay', type
: 'text', maxlen
: 3, size
: 5, prefix
: '192.88.99.  ', value
: nvram
.ipv6_relay
},
385 { title
: 'Tunnel Client IPv6 Address', multi
: [
386 { name
: 'ipv6_tun_addr', type
: 'text', maxlen
: 46, size
: 48, value
: nvram
.ipv6_tun_addr
, suffix
: ' / ' },
387 { name
: 'ipv6_tun_addrlen', type
: 'text', maxlen
: 3, size
: 5, value
: nvram
.ipv6_tun_addrlen
}
389 { title
: 'Tunnel MTU', name
: 'ipv6_tun_mtu', type
: 'text', maxlen
: 4, size
: 8, value
: nvram
.ipv6_tun_mtu
, suffix
: ' <small>(0 for default)</small>' },
390 { title
: 'Tunnel TTL', name
: 'ipv6_tun_ttl', type
: 'text', maxlen
: 3, size
: 8, value
: nvram
.ipv6_tun_ttl
},
392 { title
: 'Request /64 subnet for', name
: 'f_lan1_ipv6', type
: 'checkbox', value
: (nvram
.ipv6_vlan
& 1), suffix
: ' LAN1(br1) ' },
393 { title
: '', name
: 'f_lan2_ipv6', type
: 'checkbox', value
: (nvram
.ipv6_vlan
& 2), suffix
: ' LAN2(br2) ' },
394 { title
: '', name
: 'f_lan3_ipv6', type
: 'checkbox', value
: (nvram
.ipv6_vlan
& 4), suffix
: ' LAN3(br3) ' }
400 <script type='text/javascript'
>show_notice1('<% notice("ip6tables"); %>');</script>
404 <div class='section-title'
>Notes
</div>
405 <div class='section'
>
408 <li><b>Other ISP Configuration
</b> - Check it for some ISP's, Snap (NZ), Internode (AU).
</li>
415 <tr><td id='footer' colspan=
2>
416 <span id='footer-msg'
></span>
417 <input type='button' value='Save' id='save-button' onclick='save()'
>
418 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'
>
422 <script type='text/javascript'
>earlyInit()</script>
423 <div style='height:
100px'
></div>