3 # Copyright (C) 2011 OpenWrt.org
6 [ -e /etc/config/network ] && exit 0
8 touch /etc/config/network
10 . /lib/functions/uci-defaults.sh
13 ucidef_set_interface_loopback
15 board=$(ar71xx_board_name)
22 ucidef_set_interface_lan "eth0 eth1"
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"
34 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
35 ucidef_add_switch "switch0" "1" "1"
36 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
37 ucidef_add_switch_vlan "switch0" "2" "0t 1"
41 ucidef_set_interfaces_lan_wan "eth0" "eth1"
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"
51 ucidef_set_interfaces_lan_wan "eth1" "eth0"
52 ucidef_add_switch "switch0" "1" "1"
53 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
54 ucidef_add_switch_vlan "switch0" "2" "5 6"
60 ucidef_set_interfaces_lan_wan "eth1" "eth0"
61 ucidef_add_switch "switch0" "1" "1"
62 ucidef_add_switch_vlan "switch0" "1" "0 2 3 4 5"
63 ucidef_add_switch_vlan "switch0" "2" "1 6"
67 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
68 ucidef_add_switch "switch0" "1" "1"
69 ucidef_add_switch_vlan "switch0" "1" "0t 5"
70 ucidef_add_switch_vlan "switch0" "2" "0t 4"
79 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
80 ucidef_add_switch "switch0" "1" "1"
81 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
82 ucidef_add_switch_vlan "switch0" "2" "0t 1"
83 ucidef_add_switch "switch1" "1" "1"
84 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 4 5"
87 rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
88 ucidef_set_interface_raw "sfp" "eth0.3"
89 ucidef_add_switch_vlan "switch0" "3" "0t 6"
96 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
97 ucidef_add_switch "switch0" "1" "1"
98 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
102 ucidef_set_interfaces_lan_wan "eth0" "eth1"
103 ucidef_add_switch "switch0" "1" "1"
104 ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
108 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
109 ucidef_add_switch "switch0" "1" "1"
110 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
111 ucidef_add_switch_vlan "switch0" "2" "5 6"
116 ucidef_set_interfaces_lan_wan "eth1" "eth0"
117 ucidef_add_switch "switch0" "1" "1"
118 ucidef_add_switch_vlan "switch0" "1" "1 2 5"
122 ucidef_set_interfaces_lan_wan "eth1" "eth0"
123 ucidef_add_switch "switch0" "1" "1"
124 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
128 ucidef_set_interfaces_lan_wan "eth1" "eth0"
129 ucidef_add_switch "switch0" "1" "1"
130 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
135 ucidef_set_interfaces_lan_wan "eth1" "eth0"
136 ucidef_add_switch "switch0" "1" "1"
137 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
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"
152 ucidef_set_interfaces_lan_wan "eth1" "eth0"
156 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
157 ucidef_add_switch "switch0" "1" "1"
158 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
159 ucidef_add_switch "switch1" "1" "1"
160 ucidef_add_switch_vlan "switch1" "1" "0t 1 2 3 4"
161 ucidef_add_switch_vlan "switch1" "2" "0t 5"
167 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
168 ucidef_add_switch "switch0" "1" "1"
169 ucidef_add_switch_vlan "switch0" "1" "0t 1 3 4 5"
170 ucidef_add_switch_vlan "switch0" "2" "0t 2"
174 ucidef_set_interfaces_lan_wan "eth1" "eth0"
175 ucidef_add_switch "switch0" "1" "1"
176 ucidef_add_switch_vlan "switch0" "1" "0 1 3"
180 ucidef_set_interface_lan "eth0"
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 2 3 4 5"
188 ucidef_add_switch_vlan "switch0" "2" "0t 1"
192 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
193 ucidef_add_switch "switch0" "1" "1"
194 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
195 ucidef_add_switch_vlan "switch0" "2" "0 5t"
199 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
200 ucidef_add_switch "switch0" "1" "1"
201 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
202 ucidef_add_switch_vlan "switch0" "2" "0 9t"
207 ucidef_set_interface_raw "eth" "eth0"
208 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
220 ucidef_set_interfaces_lan_wan "eth1" "eth0"
221 ucidef_add_switch "switch0" "1" "1"
222 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
226 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
227 ucidef_add_switch "switch0" "1" "1"
228 ucidef_add_switch_vlan "switch0" "1" "0t 1"
229 ucidef_add_switch_vlan "switch0" "2" "0t 2"
233 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
234 ucidef_add_switch "switch0" "1" "1"
235 ucidef_add_switch_vlan "switch0" "1" "0t 5"
236 ucidef_add_switch_vlan "switch0" "2" "0t 1"
240 ucidef_set_interfaces_lan_wan "eth0" "eth1"
241 ucidef_add_switch "switch0" "1" "1"
242 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
246 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
247 ucidef_add_switch "switch0" "1" "1"
248 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
254 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
255 ucidef_add_switch "switch0" "1" "1"
256 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
257 ucidef_add_switch_vlan "switch0" "2" "0t 5"
258 mac=$(mtd_get_mac_ascii nvram "wan_mac")
259 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
264 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
265 ucidef_add_switch "switch0" "1" "1"
266 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
267 ucidef_add_switch_vlan "switch0" "2" "0t 5"
268 mac=$(mtd_get_mac_ascii devdata "wanmac")
269 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
276 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
277 ucidef_add_switch "switch0" "1" "1"
278 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
279 ucidef_add_switch_vlan "switch0" "2" "0t 5"
280 mac_lan=$(mtd_get_mac_binary caldata 0)
281 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
282 mac_wan=$(mtd_get_mac_binary caldata 6)
283 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
288 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
289 ucidef_add_switch "switch0" "1" "1"
290 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
291 ucidef_add_switch_vlan "switch0" "2" "0t 5"
292 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
293 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
332 ucidef_set_interface_lan "eth0"
336 ucidef_set_interface_lan "eth1"
350 ucidef_set_interfaces_lan_wan "eth1" "eth0"
382 ucidef_set_interfaces_lan_wan "eth0" "eth1"
383 ucidef_add_switch "switch0" "1" "1"
384 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
388 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
389 ucidef_add_switch "switch0" "1" "1"
390 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
391 ucidef_add_switch_vlan "switch0" "2" "0t 1"
395 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
396 ucidef_add_switch "switch0" "1" "1"
397 ucidef_add_switch_vlan "switch0" "1" "0t 1 2"
398 ucidef_add_switch_vlan "switch0" "2" "0t 3"
402 ucidef_set_interfaces_lan_wan "eth0" "eth1"
403 ucidef_add_switch "switch0" "1" "1"
404 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
408 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
409 ucidef_add_switch "switch0" "1" "1"
410 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
411 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
412 uci set network.@switch[-1].blinkrate='2'
414 ucidef_add_switch_port "switch0" "1"
415 # Port 1 controls the GREEN configuration of LEDs for
416 # the switch and the section does not correspond to a real
419 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
420 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
421 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
422 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
423 # 14: Link (master); 15: separate register
424 uci set network.@switch_port[-1].led='6'
426 ucidef_add_switch_port "switch0" "2"
427 # Port 2 controls the ORANGE configuration of LEDs for
428 # the switch and the section does not correspond to a real
431 # See the key above for switch port 1 for the meaning of the
432 # 'led' setting below.
433 uci set network.@switch_port[-1].led='9'
435 ucidef_add_switch_port "switch0" "5"
436 # Port 5 controls the configuration of the WAN LED and the
437 # section does not correspond to a real switch port.
439 # To toggle the use of green or orange LEDs for the WAN port,
440 # see the LED setting for wndr3700:green:wan in /etc/config/system.
442 # See the key above for switch port 1 for the meaning of the
443 # 'led' setting below.
444 uci set network.@switch_port[-1].led='2'
448 ucidef_set_interfaces_lan_wan "eth0" "eth1"