ar71xx: add support for TP-Link TL-WDR6500 v2
[openwrt.git] / target / linux / ar71xx / base-files / etc / uci-defaults / 02_network
1 #!/bin/sh
2 #
3 # Copyright (C) 2011 OpenWrt.org
4 #
5
6 [ -e /etc/config/network ] && exit 0
7
8 touch /etc/config/network
9
10 . /lib/functions/uci-defaults.sh
11 . /lib/ar71xx.sh
12
13 ucidef_set_interface_loopback
14
15 board=$(ar71xx_board_name)
16
17 case "$board" in
18 all0315n |\
19 all0258n |\
20 ja76pf2|\
21 rocket-m-ti |\
22 ubnt-unifi-outdoor)
23         ucidef_set_interface_lan "eth0 eth1"
24         ;;
25
26 ap132 |\
27 wlr8100)
28         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
29         ucidef_add_switch "switch0" "1" "1"
30         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
31         ucidef_add_switch_vlan "switch0" "2" "0t 1"
32         ;;
33
34 esr1750 |\
35 epg5000)
36         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
37         ucidef_add_switch "switch0" "1" "1"
38         ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
39         ucidef_add_switch_vlan "switch0" "2" "0t 5"
40         ;;
41
42 ap136-010)
43         ucidef_set_interfaces_lan_wan "eth0" "eth1"
44         ucidef_add_switch "switch0" "1" "1"
45         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
46         ucidef_add_switch_vlan "switch0" "2" "5 6"
47         ;;
48
49 ap147-010)
50         ucidef_set_interfaces_lan_wan "eth0" "eth1"
51         ucidef_add_switch "switch0" "1" "1"
52         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
53         ucidef_add_switch_vlan "switch0" "2" "5 6"
54         ;;
55
56 ap136-020 |\
57 ap135-020 |\
58 tl-wr1043nd-v2 |\
59 wzr-450hp2)
60         ucidef_set_interfaces_lan_wan "eth1" "eth0"
61         ucidef_add_switch "switch0" "1" "1"
62         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
63         ucidef_add_switch_vlan "switch0" "2" "5 6"
64         ;;
65
66 archer-c5 |\
67 archer-c7 |\
68 tl-wdr4900-v2)
69         ucidef_set_interfaces_lan_wan "eth1" "eth0"
70         ucidef_add_switch "switch0" "1" "1"
71         ucidef_add_switch_vlan "switch0" "1" "0 2 3 4 5"
72         ucidef_add_switch_vlan "switch0" "2" "1 6"
73         ;;
74
75 bsb)
76         ucidef_set_interfaces_lan_wan "eth1" "eth0"
77         ucidef_add_switch "switch0" "1" "1"
78         ucidef_add_switch_vlan "switch0" "1" "0 1 3"
79         ucidef_set_interface_wlan
80         ;;
81
82 cpe510)
83         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
84         ucidef_add_switch "switch0" "1" "1"
85         ucidef_add_switch_vlan "switch0" "1" "0t 5"
86         ucidef_add_switch_vlan "switch0" "2" "0t 4"
87         ;;
88
89 db120 |\
90 rb-2011l | \
91 rb-2011uas |\
92 rb-2011uias |\
93 rb-2011uas-2hnd|\
94 rb-2011uias-2hnd)
95         ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
96         ucidef_add_switch "switch0" "1" "1"
97         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
98         ucidef_add_switch_vlan "switch0" "2" "0t 1"
99         ucidef_add_switch "switch1" "1" "1"
100         ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 4 5"
101
102         case "$board" in
103         rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
104                 ucidef_set_interface_raw "sfp" "eth0.3"
105                 ucidef_add_switch_vlan "switch0" "3" "0t 6"
106                 ;;
107         esac
108         ;;
109
110 dir-825-b1|\
111 tew-673gru)
112         ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
113         ucidef_add_switch "switch0" "1" "1"
114         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
115         ;;
116
117 f9k1115v2)
118         ucidef_set_interfaces_lan_wan "eth1" "eth0"
119         ucidef_add_switch "switch0" "1" "1"
120         ucidef_add_switch_vlan "switch0" "1" "2 3 4 5 6"
121         ucidef_add_switch_vlan "switch0" "2" "0 1"
122         ;;
123
124 nbg460n_550n_550nh)
125         ucidef_set_interfaces_lan_wan "eth0" "eth1"
126         ucidef_add_switch "switch0" "1" "1"
127         ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
128         ;;
129
130 nbg6716)
131         ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
132         ucidef_add_switch "switch0" "1" "1"
133         ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
134         ucidef_add_switch_vlan "switch0" "2" "5 6"
135         ;;
136
137 rb-433 |\
138 rb-433u)
139         ucidef_set_interfaces_lan_wan "eth1" "eth0"
140         ucidef_add_switch "switch0" "1" "1"
141         ucidef_add_switch_vlan "switch0" "1" "1 2 5"
142         ;;
143
144 rb-435g)
145         ucidef_set_interfaces_lan_wan "eth1" "eth0"
146         ucidef_add_switch "switch0" "1" "1"
147         ucidef_add_switch_vlan "switch0" "1" "0 1 2"
148         ;;
149
150 rb-450)
151         ucidef_set_interfaces_lan_wan "eth1" "eth0"
152         ucidef_add_switch "switch0" "1" "1"
153         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
154         ;;
155
156 rb-450g |\
157 routerstation-pro)
158         ucidef_set_interfaces_lan_wan "eth1" "eth0"
159         ucidef_add_switch "switch0" "1" "1"
160         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
161         ;;
162
163 ap136 |\
164 rb-750gl |\
165 rb-751g |\
166 rb-951g-2hnd |\
167 wzr-hp-g450h)
168         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
169         ucidef_add_switch "switch0" "1" "1"
170         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
171         ucidef_add_switch_vlan "switch0" "2" "0t 1"
172         ;;
173
174 rb-951ui-2hnd)
175         ucidef_set_interfaces_lan_wan "eth1" "eth0"
176         ;;
177
178 rb-493g)
179         ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
180         ucidef_add_switch "switch0" "1" "1"
181         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
182         ucidef_add_switch "switch1" "1" "1"
183         ucidef_add_switch_vlan "switch1" "1" "0t 1 2 3 4"
184         ucidef_add_switch_vlan "switch1" "2" "0t 5"
185         ;;
186
187 wzr-hp-g300nh2 |\
188 pb92 |\
189 ap113)
190         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
191         ucidef_add_switch "switch0" "1" "1"
192         ucidef_add_switch_vlan "switch0" "1" "0t 1 3 4 5"
193         ucidef_add_switch_vlan "switch0" "2" "0t 2"
194         ;;
195
196 el-m150)
197         ucidef_set_interfaces_lan_wan "eth1" "eth0"
198         ucidef_add_switch "switch0" "1" "1"
199         ucidef_add_switch_vlan "switch0" "1" "0 1 3"
200         ;;
201
202 tl-wdr4300|\
203 tl-wr1041n-v2)
204         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
205         ucidef_add_switch "switch0" "1" "1"
206         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
207         ucidef_add_switch_vlan "switch0" "2" "0t 1"
208         ;;
209
210 tl-wr1043nd)
211         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
212         ucidef_add_switch "switch0" "1" "1"
213         ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
214         ucidef_add_switch_vlan "switch0" "2" "0 5t"
215         ;;
216
217 tl-wr2543n)
218         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
219         ucidef_add_switch "switch0" "1" "1"
220         ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
221         ucidef_add_switch_vlan "switch0" "2" "0 9t"
222         ;;
223
224 tl-wr841n-v1|\
225 tl-wr941nd)
226         ucidef_set_interface_raw "eth" "eth0"
227         ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
228         ;;
229
230 dir-615-i1 |\
231 r6100 |\
232 smart-300 |\
233 tl-mr3420-v2 |\
234 tl-wr841n-v8 |\
235 tl-wr842n-v2 |\
236 tl-wr941nd-v5 |\
237 tl-wdr6500-v2 |\
238 wnr2000-v3 |\
239 wnr2000-v4 |\
240 wnr2200 |\
241 wnr612-v2 |\
242 wnr1000-v2)
243         ucidef_set_interfaces_lan_wan "eth1" "eth0"
244         ucidef_add_switch "switch0" "1" "1"
245         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
246         ;;
247
248 uap-pro)
249         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
250         ucidef_add_switch "switch0" "1" "1"
251         ucidef_add_switch_vlan "switch0" "1" "0t 1"
252         ucidef_add_switch_vlan "switch0" "2" "0t 2"
253         ;;
254
255 nanostation-m-xw)
256         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
257         ucidef_add_switch "switch0" "1" "1"
258         ucidef_add_switch_vlan "switch0" "1" "0t 5"
259         ucidef_add_switch_vlan "switch0" "2" "0t 1"
260         ;;
261
262 wrt160nl)
263         ucidef_set_interfaces_lan_wan "eth0" "eth1"
264         ucidef_add_switch "switch0" "1" "1"
265         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
266         ;;
267
268 wzr-hp-g300nh)
269         ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
270         ucidef_add_switch "switch0" "1" "1"
271         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
272         ;;
273
274 dgl-5500-a1 |\
275 dir-825-c1)
276         local mac
277         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
278         ucidef_add_switch "switch0" "1" "1"
279         ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
280         ucidef_add_switch_vlan "switch0" "2" "0t 5"
281         mac=$(mtd_get_mac_ascii nvram "wan_mac")
282         [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
283         ;;
284
285 mynet-n750)
286         local mac
287         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
288         ucidef_add_switch "switch0" "1" "1"
289         ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
290         ucidef_add_switch_vlan "switch0" "2" "0t 5"
291         mac=$(mtd_get_mac_ascii devdata "wanmac")
292         [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
293         ;;
294
295 onion-omega)
296         ucidef_set_interface_lan "wlan0"
297         ;;
298
299 dhp-1565-a1 |\
300 dir-835-a1 |\
301 wndr3700v4 | \
302 wndr4300)
303         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
304         ucidef_add_switch "switch0" "1" "1"
305         ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
306         ucidef_add_switch_vlan "switch0" "2" "0t 5"
307         mac_lan=$(mtd_get_mac_binary caldata 0)
308         [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
309         mac_wan=$(mtd_get_mac_binary caldata 6)
310         [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
311         ;;
312
313 esr900)
314         local mac
315         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
316         ucidef_add_switch "switch0" "1" "1"
317         ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
318         ucidef_add_switch_vlan "switch0" "2" "0t 5"
319         mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
320         [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
321         ;;
322
323 dlan-pro-500-wp)
324         ucidef_set_interface_lan "eth0 eth1"
325         ;;
326
327 dlan-pro-1200-ac)
328         ucidef_set_interface_lan "eth0"
329         ucidef_add_switch "switch0" "1" "0"
330         ucidef_add_switch_vlan "switch0" "0" "0 2 3 4"
331         ;;
332
333 all0305 |\
334 aw-nr580 |\
335 bullet-m |\
336 cap4200ag |\
337 eap300v2 |\
338 eap7660d |\
339 el-mini |\
340 loco-m-xw |\
341 mr600 |\
342 mr600v2 |\
343 mr900 |\
344 mr900v2 |\
345 rb-411 |\
346 rb-911g-2hpnd |\
347 rb-911g-5hpacd |\
348 rb-911g-5hpnd |\
349 rb-912uag-2hpnd |\
350 rb-912uag-5hpnd |\
351 rb-sxt2n |\
352 rb-sxt5n |\
353 rocket-m-xw |\
354 tl-mr10u |\
355 tl-mr11u |\
356 tl-mr12u |\
357 tl-mr13u |\
358 tl-mr3020 |\
359 tl-mr3040 |\
360 tl-mr3040-v2 |\
361 tl-wa701nd-v2 |\
362 tl-wa7210n-v2 |\
363 tl-wa750re |\
364 tl-wa850re |\
365 tl-wa830re-v2 |\
366 tl-wa801nd-v2 |\
367 tl-wa901nd |\
368 tl-wa901nd-v2 |\
369 tl-wa901nd-v3 |\
370 tl-wr703n |\
371 tube2h |\
372 wndap360 |\
373 mynet-rext |\
374 wp543)
375         ucidef_set_interface_lan "eth0"
376         ;;
377
378 antminer-s1 |\
379 antminer-s3 |\
380 dir-505-a1)
381         ucidef_set_interface_lan "eth1"
382         ;;
383
384 alfa-ap96 |\
385 alfa-nx |\
386 ap83 |\
387 gl-inet |\
388 jwap003 |\
389 pb42 |\
390 pb44 |\
391 routerstation|\
392 tl-wr710n |\
393 tl-wr720n-v3|\
394 wpe72)
395         ucidef_set_interfaces_lan_wan "eth1" "eth0"
396         ;;
397
398 wpj344)
399         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
400         ucidef_add_switch "switch0" "1" "1"
401         ucidef_add_switch_vlan "switch0" "1" "0t 3"
402         ucidef_add_switch_vlan "switch0" "2" "0t 2"
403         ;;
404
405 wpj531)
406         ucidef_set_interfaces_lan_wan "eth0" "eth1"
407         ;;
408
409 wpj558)
410         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
411         ucidef_add_switch "switch0" "1" "1"
412         ucidef_add_switch_vlan "switch0" "1" "5 6t"
413         ucidef_add_switch_vlan "switch0" "2" "1 6t"
414         ;;
415
416 ap121 |\
417 ap121-mini |\
418 ap143 |\
419 ap96 |\
420 airrouter |\
421 dir-600-a1 |\
422 dir-615-c1 |\
423 dir-615-e1 |\
424 dir-615-e4 |\
425 hiwifi-hc6361 |\
426 ja76pf |\
427 mc-mac1200r|\
428 mynet-n600 |\
429 oolite |\
430 qihoo-c301 |\
431 rb-750 |\
432 rb-751 |\
433 tew-632brp |\
434 tew-712br |\
435 tl-mr3220 |\
436 tl-mr3220-v2 |\
437 tl-mr3420 |\
438 tl-wdr3500 |\
439 tl-wr741nd |\
440 tl-wr741nd-v4 |\
441 tl-wr841n-v7 |\
442 tl-wr841n-v9 |\
443 whr-g301n |\
444 whr-hp-g300n |\
445 whr-hp-gn |\
446 wzr-hp-ag300h)
447         ucidef_set_interfaces_lan_wan "eth0" "eth1"
448         ucidef_add_switch "switch0" "1" "1"
449         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
450         ;;
451
452 wzr-hp-g450h)
453         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
454         ucidef_add_switch "switch0" "1" "1"
455         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
456         ucidef_add_switch_vlan "switch0" "2" "0t 1"
457         ;;
458
459 ew-dorin)
460         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
461         ucidef_add_switch "switch0" "1" "1"
462         ucidef_add_switch_vlan "switch0" "1" "0t 1 2"
463         ucidef_add_switch_vlan "switch0" "2" "0t 3"
464         ;;
465
466 ew-dorin-router)
467         ucidef_set_interfaces_lan_wan "eth0" "eth1"
468         ucidef_add_switch "switch0" "1" "1"
469         ucidef_add_switch_vlan "switch0" "1" "0 2 3"
470         ;;
471
472 wndr3700)
473         ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
474         ucidef_add_switch "switch0" "1" "1"
475         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
476         # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
477         uci set network.@switch[-1].blinkrate='2'
478
479         ucidef_add_switch_port "switch0" "1"
480         # Port 1 controls the GREEN configuration of LEDs for
481         # the switch and the section does not correspond to a real
482         # switch port.
483         #
484         # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
485         # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
486         # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
487         # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
488         # 14: Link (master); 15: separate register
489         uci set network.@switch_port[-1].led='6'
490
491         ucidef_add_switch_port "switch0" "2"
492         # Port 2 controls the ORANGE configuration of LEDs for
493         # the switch and the section does not correspond to a real
494         # switch port.
495         #
496         # See the key above for switch port 1 for the meaning of the
497         # 'led' setting below.
498         uci set network.@switch_port[-1].led='9'
499
500         ucidef_add_switch_port "switch0" "5"
501         # Port 5 controls the configuration of the WAN LED and the
502         # section does not correspond to a real switch port.
503         #
504         # To toggle the use of green or orange LEDs for the WAN port,
505         # see the LED setting for wndr3700:green:wan in /etc/config/system.
506         #
507         # See the key above for switch port 1 for the meaning of the
508         # 'led' setting below.
509         uci set network.@switch_port[-1].led='2'
510         ;;
511
512 *)
513         ucidef_set_interfaces_lan_wan "eth0" "eth1"
514         ;;
515 esac
516
517 uci commit network
518
519 exit 0