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