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