ar71xx: add support for EasyLink M150 and M-mini
[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 tl-mr10u |\
263 tl-mr11u |\
264 tl-mr13u |\
265 tl-mr3020 |\
266 tl-mr3040 |\
267 tl-mr3040-v2 |\
268 tl-wa750re |\
269 tl-wa850re |\
270 tl-wa801nd-v2 |\
271 tl-wa901nd |\
272 tl-wa901nd-v2 |\
273 tl-wa901nd-v3 |\
274 tl-wr703n |\
275 wndap360 |\
276 mynet-rext |\
277 wp543)
278 ucidef_set_interface_lan "eth0"
279 ;;
280
281 dir-505-a1)
282 ucidef_set_interface_lan "eth1"
283 ;;
284
285 alfa-ap96 |\
286 alfa-nx |\
287 ap83 |\
288 jwap003 |\
289 pb42 |\
290 pb44 |\
291 routerstation|\
292 tl-wr710n |\
293 tl-wr720n-v3|\
294 wpe72)
295 ucidef_set_interfaces_lan_wan "eth1" "eth0"
296 ;;
297
298 ap121 |\
299 ap121-mini |\
300 ap96 |\
301 airrouter |\
302 dir-600-a1 |\
303 dir-615-c1 |\
304 dir-615-e1 |\
305 dir-615-e4 |\
306 hiwifi-hc6361 |\
307 ja76pf |\
308 mynet-n600 |\
309 oolite |\
310 rb-750 |\
311 rb-751 |\
312 tew-632brp |\
313 tew-712br |\
314 tl-mr3220 |\
315 tl-mr3220-v2 |\
316 tl-mr3420 |\
317 tl-wdr3500 |\
318 tl-wr741nd |\
319 tl-wr741nd-v4 |\
320 tl-wr841n-v7 |\
321 tl-wr841n-v9 |\
322 whr-g301n |\
323 whr-hp-g300n |\
324 whr-hp-gn |\
325 wzr-hp-ag300h)
326 ucidef_set_interfaces_lan_wan "eth0" "eth1"
327 ucidef_add_switch "switch0" "1" "1"
328 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
329 ;;
330
331 wzr-hp-g450h)
332 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
333 ucidef_add_switch "switch0" "1" "1"
334 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
335 ucidef_add_switch_vlan "switch0" "2" "0t 1"
336 ;;
337
338 ew-dorin)
339 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
340 ucidef_add_switch "switch0" "1" "1"
341 ucidef_add_switch_vlan "switch0" "1" "0t 1 2"
342 ucidef_add_switch_vlan "switch0" "2" "0t 3"
343 ;;
344
345 ew-dorin-router)
346 ucidef_set_interfaces_lan_wan "eth0" "eth1"
347 ucidef_add_switch "switch0" "1" "1"
348 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
349 ;;
350
351 wndr3700)
352 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
353 ucidef_add_switch "switch0" "1" "1"
354 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
355 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
356 uci set network.@switch[-1].blinkrate='2'
357
358 ucidef_add_switch_port "switch0" "1"
359 # Port 1 controls the GREEN configuration of LEDs for
360 # the switch and the section does not correspond to a real
361 # switch port.
362 #
363 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
364 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
365 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
366 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
367 # 14: Link (master); 15: separate register
368 uci set network.@switch_port[-1].led='6'
369
370 ucidef_add_switch_port "switch0" "2"
371 # Port 2 controls the ORANGE configuration of LEDs for
372 # the switch and the section does not correspond to a real
373 # switch port.
374 #
375 # See the key above for switch port 1 for the meaning of the
376 # 'led' setting below.
377 uci set network.@switch_port[-1].led='9'
378
379 ucidef_add_switch_port "switch0" "5"
380 # Port 5 controls the configuration of the WAN LED and the
381 # section does not correspond to a real switch port.
382 #
383 # To toggle the use of green or orange LEDs for the WAN port,
384 # see the LED setting for wndr3700:green:wan in /etc/config/system.
385 #
386 # See the key above for switch port 1 for the meaning of the
387 # 'led' setting below.
388 uci set network.@switch_port[-1].led='2'
389 ;;
390
391 *)
392 ucidef_set_interfaces_lan_wan "eth0" "eth1"
393 ;;
394 esac
395
396 uci commit network
397
398 exit 0