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