ar71xx: wndr4300: set official mac addresses
[openwrt/staging/yousong.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 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
27 ucidef_add_switch "switch0" "1" "1"
28 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
29 ucidef_add_switch_vlan "switch0" "2" "0t 1"
30 ;;
31
32 ap136-010 |\
33 wlr8100)
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 ucidef_set_interfaces_lan_wan "eth1" "eth0"
43 ucidef_add_switch "switch0" "1" "1"
44 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
45 ucidef_add_switch_vlan "switch0" "2" "5 6"
46 ;;
47
48 archer-c7)
49 ucidef_set_interfaces_lan_wan "eth1" "eth0"
50 ucidef_add_switch "switch0" "1" "1"
51 ucidef_add_switch_vlan "switch0" "1" "0 2 3 4 5"
52 ucidef_add_switch_vlan "switch0" "2" "1 6"
53 ;;
54
55 db120 |\
56 rb-2011l | \
57 rb-2011uas |\
58 rb-2011uas-2hnd)
59 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
60 ucidef_add_switch "switch0" "1" "1"
61 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
62 ucidef_add_switch_vlan "switch0" "2" "0t 1"
63 ucidef_add_switch "switch1" "1" "1"
64 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 4 5"
65
66 case "$board" in
67 rb-2011uas*)
68 ucidef_set_interface_raw "sfp" "eth0.3"
69 ucidef_add_switch_vlan "switch0" "3" "0t 6"
70 ;;
71 esac
72 ;;
73
74 dir-825-b1|\
75 tew-673gru)
76 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
77 ucidef_add_switch "switch0" "1" "1"
78 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
79 ;;
80
81 nbg460n_550n_550nh)
82 ucidef_set_interfaces_lan_wan "eth0" "eth1"
83 ucidef_add_switch "switch0" "1" "1"
84 ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
85 ;;
86
87 rb-433 |\
88 rb-433u)
89 ucidef_set_interfaces_lan_wan "eth1" "eth0"
90 ucidef_add_switch "switch0" "1" "1"
91 ucidef_add_switch_vlan "switch0" "1" "1 2 5"
92 ;;
93
94 rb-435g)
95 ucidef_set_interfaces_lan_wan "eth1" "eth0"
96 ucidef_add_switch "switch0" "1" "1"
97 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
98 ;;
99
100 rb-450)
101 ucidef_set_interfaces_lan_wan "eth1" "eth0"
102 ucidef_add_switch "switch0" "1" "1"
103 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
104 ;;
105
106 rb-450g |\
107 routerstation-pro)
108 ucidef_set_interfaces_lan_wan "eth1" "eth0"
109 ucidef_add_switch "switch0" "1" "1"
110 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
111 ;;
112
113 ap136 |\
114 rb-750gl |\
115 rb-751g |\
116 rb-951g-2hnd |\
117 wzr-hp-g450h)
118 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
119 ucidef_add_switch "switch0" "1" "1"
120 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
121 ucidef_add_switch_vlan "switch0" "2" "0t 1"
122 ;;
123
124 rb-493g)
125 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
126 ucidef_add_switch "switch0" "1" "1"
127 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
128 ucidef_add_switch "switch1" "1" "1"
129 ucidef_add_switch_vlan "switch1" "1" "0t 1 2 3 4"
130 ucidef_add_switch_vlan "switch1" "2" "0t 5"
131 ;;
132
133 wzr-hp-g300nh2 |\
134 pb92 |\
135 ap113)
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 1 3 4 5"
139 ucidef_add_switch_vlan "switch0" "2" "0t 2"
140 ;;
141
142 tl-wdr4300|\
143 tl-wr1041n-v2)
144 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
145 ucidef_add_switch "switch0" "1" "1"
146 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
147 ucidef_add_switch_vlan "switch0" "2" "0t 1"
148 ;;
149
150 tl-wr1043nd)
151 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
152 ucidef_add_switch "switch0" "1" "1"
153 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
154 ucidef_add_switch_vlan "switch0" "2" "0 5t"
155 ;;
156
157 tl-wr2543n)
158 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
159 ucidef_add_switch "switch0" "1" "1"
160 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
161 ucidef_add_switch_vlan "switch0" "2" "0 9t"
162 ;;
163
164 tl-wr841n-v1|\
165 tl-wr941nd)
166 ucidef_set_interface_raw "eth" "eth0"
167 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
168 ;;
169
170 tl-mr3420-v2 |\
171 tl-wr841n-v8 |\
172 wnr2000-v3 |\
173 wnr2200 |\
174 wnr612-v2)
175 ucidef_set_interfaces_lan_wan "eth1" "eth0"
176 ucidef_add_switch "switch0" "1" "1"
177 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
178 ;;
179
180 uap-pro)
181 ucidef_set_interface_lan "eth0"
182 ucidef_add_switch "switch0" "1" "1"
183 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
184 ;;
185
186 wrt160nl)
187 ucidef_set_interfaces_lan_wan "eth0" "eth1"
188 ucidef_add_switch "switch0" "1" "1"
189 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
190 ;;
191
192 wzr-hp-g300nh)
193 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
194 ucidef_add_switch "switch0" "1" "1"
195 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
196 ;;
197
198 dir-825-c1)
199 local mac
200 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
201 ucidef_add_switch "switch0" "1" "1"
202 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
203 ucidef_add_switch_vlan "switch0" "2" "0t 5"
204 mac=$(mtd_get_mac_ascii nvram "^wan_mac")
205 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
206 ;;
207
208 dir-835-a1 |\
209 wndr4300)
210 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
211 ucidef_add_switch "switch0" "1" "1"
212 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
213 ucidef_add_switch_vlan "switch0" "2" "0t 5"
214 mac_lan=$(mtd_get_mac_binary caldata 0)
215 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
216 mac_wan=$(mtd_get_mac_binary caldata 6)
217 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
218 ;;
219
220 all0305 |\
221 aw-nr580 |\
222 bullet-m |\
223 cap4200ag |\
224 eap7660d |\
225 mr600 |\
226 mr600v2 |\
227 rb-411 |\
228 tl-mr10u |\
229 tl-mr11u |\
230 tl-mr13u |\
231 tl-mr3020 |\
232 tl-mr3040 |\
233 tl-mr3040-v2 |\
234 tl-wa750re |\
235 tl-wa850re |\
236 tl-wa901nd |\
237 tl-wa901nd-v2 |\
238 tl-wr703n |\
239 wndap360 |\
240 mynet-rext |\
241 wp543)
242 ucidef_set_interface_lan "eth0"
243 ;;
244
245 dir-505-a1)
246 ucidef_set_interface_lan "eth1"
247 ;;
248
249 alfa-ap96 |\
250 alfa-nx |\
251 ap83 |\
252 jwap003 |\
253 pb42 |\
254 pb44 |\
255 routerstation|\
256 tl-wr710n |\
257 tl-wr720n-v3|\
258 wpe72)
259 ucidef_set_interfaces_lan_wan "eth1" "eth0"
260 ;;
261
262 ap121 |\
263 ap121-mini |\
264 ap96 |\
265 airrouter |\
266 dir-600-a1 |\
267 dir-615-c1 |\
268 dir-615-e4 |\
269 ja76pf |\
270 mynet-n600 |\
271 rb-750 |\
272 rb-751 |\
273 tew-632brp |\
274 tew-712br |\
275 tl-mr3220 |\
276 tl-mr3220-v2 |\
277 tl-mr3420 |\
278 tl-wdr3500 |\
279 tl-wr741nd |\
280 tl-wr741nd-v4 |\
281 tl-wr841n-v7 |\
282 whr-g301n |\
283 whr-hp-g300n |\
284 whr-hp-gn |\
285 wzr-hp-ag300h)
286 ucidef_set_interfaces_lan_wan "eth0" "eth1"
287 ucidef_add_switch "switch0" "1" "1"
288 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
289 ;;
290
291 wzr-hp-g450h)
292 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
293 ucidef_add_switch "switch0" "1" "1"
294 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
295 ucidef_add_switch_vlan "switch0" "2" "0t 1"
296 ;;
297
298 ew-dorin)
299 ucidef_set_interface_lan "eth0"
300 ucidef_add_switch "switch0" "1" "1"
301 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3"
302 ;;
303
304 ew-dorin-router)
305 ucidef_set_interfaces_lan_wan "eth0" "eth1"
306 ucidef_add_switch "switch0" "1" "1"
307 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
308 ;;
309
310 *)
311 ucidef_set_interfaces_lan_wan "eth0" "eth1"
312 ;;
313 esac
314
315 uci commit network
316
317 exit 0