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