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