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