bc98982f37008b340fbb7b3da2230b8790dddb49
[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         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 db120 |\
48 rb-2011l | \
49 rb-2011uas-2hnd)
50         ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
51         ucidef_add_switch "switch0" "1" "1"
52         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
53         ucidef_add_switch_vlan "switch0" "2" "0t 1"
54         ucidef_add_switch "switch1" "1" "1"
55         ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 4 5"
56         ;;
57
58 dir-825-b1|\
59 tew-673gru)
60         ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
61         ucidef_add_switch "switch0" "1" "1"
62         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
63         ;;
64
65 nbg460n_550n_550nh)
66         ucidef_set_interfaces_lan_wan "eth0" "eth1"
67         ucidef_add_switch "switch0" "1" "1"
68         ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
69         ;;
70
71 rb-433 |\
72 rb-433u)
73         ucidef_set_interfaces_lan_wan "eth1" "eth0"
74         ucidef_add_switch "switch0" "1" "1"
75         ucidef_add_switch_vlan "switch0" "1" "1 2 5"
76         ;;
77
78 rb-435g)
79         ucidef_set_interfaces_lan_wan "eth1" "eth0"
80         ucidef_add_switch "switch0" "1" "1"
81         ucidef_add_switch_vlan "switch0" "1" "0 1 2"
82         ;;
83
84 rb-450)
85         ucidef_set_interfaces_lan_wan "eth1" "eth0"
86         ucidef_add_switch "switch0" "1" "1"
87         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
88         ;;
89
90 rb-450g |\
91 routerstation-pro)
92         ucidef_set_interfaces_lan_wan "eth1" "eth0"
93         ucidef_add_switch "switch0" "1" "1"
94         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
95         ;;
96
97 ap136 |\
98 rb-750gl |\
99 rb-751g |\
100 rb-951g-2hnd |\
101 wzr-hp-g450h)
102         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
103         ucidef_add_switch "switch0" "1" "1"
104         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
105         ucidef_add_switch_vlan "switch0" "2" "0t 1"
106         ;;
107
108 rb-493g)
109         ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
110         ucidef_add_switch "switch0" "1" "1"
111         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
112         ucidef_add_switch "switch1" "1" "1"
113         ucidef_add_switch_vlan "switch1" "1" "0t 1 2 3 4"
114         ucidef_add_switch_vlan "switch1" "2" "0t 5"
115         ;;
116
117 wzr-hp-g300nh2 |\
118 pb92 |\
119 ap113)
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 1 3 4 5"
123         ucidef_add_switch_vlan "switch0" "2" "0t 2"
124         ;;
125
126 tl-wdr4300|\
127 tl-wr1041n-v2)
128         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
129         ucidef_add_switch "switch0" "1" "1"
130         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
131         ucidef_add_switch_vlan "switch0" "2" "0t 1"
132         ;;
133
134 tl-wr1043nd)
135         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
136         ucidef_add_switch "switch0" "1" "1"
137         ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
138         ucidef_add_switch_vlan "switch0" "2" "0 5t"
139         ;;
140
141 tl-wr2543n)
142         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
143         ucidef_add_switch "switch0" "1" "1"
144         ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
145         ucidef_add_switch_vlan "switch0" "2" "0 9t"
146         ;;
147
148 tl-wr841n-v1|\
149 tl-wr941nd)
150         ucidef_set_interface_raw "eth" "eth0"
151         ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
152         ;;
153
154 tl-wr841n-v8)
155         ucidef_set_interfaces_lan_wan "eth1" "eth0"
156         ucidef_add_switch "switch0" "1" "1"
157         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
158         ;;
159
160 uap-pro)
161         ucidef_set_interface_lan "eth0"
162         ucidef_add_switch "switch0" "1" "1"
163         ucidef_add_switch_vlan "switch0" "1" "0 1 2"
164         ;;
165
166 wrt160nl)
167         ucidef_set_interfaces_lan_wan "eth0" "eth1"
168         ucidef_add_switch "switch0" "1" "1"
169         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
170         ;;
171
172 wzr-hp-g300nh)
173         ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
174         ucidef_add_switch "switch0" "1" "1"
175         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
176         ;;
177
178 dir-825-c1 |\
179 dir-835-a1 |\
180 wndr4300)
181         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
182         ucidef_add_switch "switch0" "1" "1"
183         ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
184         ucidef_add_switch_vlan "switch0" "2" "0t 5"
185         ;;
186
187 all0305 |\
188 aw-nr580 |\
189 bullet-m |\
190 cap4200ag |\
191 eap7660d |\
192 mr600 |\
193 mr600v2 |\
194 rb-411 |\
195 tl-mr11u |\
196 tl-mr3020 |\
197 tl-mr3040 |\
198 tl-wa901nd |\
199 tl-wa901nd-v2 |\
200 tl-wr703n |\
201 wp543)
202         ucidef_set_interface_lan "eth0"
203         ;;
204
205 alfa-ap96 |\
206 alfa-nx |\
207 ap83 |\
208 jwap003 |\
209 pb42 |\
210 pb44 |\
211 routerstation|\
212 wpe72)
213         ucidef_set_interfaces_lan_wan "eth1" "eth0"
214         ;;
215
216 ap121 |\
217 ap121-mini |\
218 ap96 |\
219 airrouter |\
220 dir-600-a1 |\
221 dir-615-c1 |\
222 dir-615-e4 |\
223 ja76pf |\
224 rb-750 |\
225 rb-751 |\
226 tew-632brp |\
227 tew-712br |\
228 tl-mr3220 |\
229 tl-mr3220-v2 |\
230 tl-mr3420 |\
231 tl-wr741nd |\
232 tl-wr741nd-v4 |\
233 tl-wr841n-v7 |\
234 whr-g301n |\
235 whr-hp-g300n |\
236 whr-hp-gn |\
237 wzr-hp-ag300h)
238         ucidef_set_interfaces_lan_wan "eth0" "eth1"
239         ucidef_add_switch "switch0" "1" "1"
240         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
241         ;;
242
243 wzr-hp-g450h)
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 2 3 4 5"
247         ucidef_add_switch_vlan "switch0" "2" "0t 1"
248         ;;
249
250 ew-dorin)
251         ucidef_set_interface_lan "eth0"
252         ucidef_add_switch "switch0" "1" "1"
253         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3"
254         ;;
255
256 ew-dorin-router)
257         ucidef_set_interfaces_lan_wan "eth0" "eth1"
258         ucidef_add_switch "switch0" "1" "1"
259         ucidef_add_switch_vlan "switch0" "1" "0 2 3"
260         ;;
261
262 *)
263         ucidef_set_interfaces_lan_wan "eth0" "eth1"
264         ;;
265 esac
266
267 uci commit network
268
269 exit 0