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