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