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