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